Import Upstream version 1.7.2
This commit is contained in:
34
contrib/0anacron
Normal file
34
contrib/0anacron
Normal file
@@ -0,0 +1,34 @@
|
||||
#!/bin/sh
|
||||
# Check whether 0anacron was run today already
|
||||
if test -r /var/spool/anacron/cron.daily; then
|
||||
day=`cat /var/spool/anacron/cron.daily`
|
||||
fi
|
||||
if [ `date +%Y%m%d` = "$day" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Check whether run on battery should be allowed
|
||||
if test -r /etc/default/anacron; then
|
||||
. /etc/default/anacron
|
||||
fi
|
||||
|
||||
if [ "$ANACRON_RUN_ON_BATTERY_POWER" != "yes" ]; then
|
||||
|
||||
# Do not run jobs when on battery power
|
||||
online=1
|
||||
for psupply in /sys/class/power_supply/* ; do
|
||||
if [ `cat "$psupply/type" 2>/dev/null`x = Mainsx ] && [ -f "$psupply/online" ]; then
|
||||
if [ `cat "$psupply/online" 2>/dev/null`x = 1x ]; then
|
||||
online=1
|
||||
break
|
||||
else
|
||||
online=0
|
||||
fi
|
||||
fi
|
||||
done
|
||||
if [ $online = 0 ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
fi
|
||||
/usr/sbin/anacron -s
|
||||
Reference in New Issue
Block a user