From: Tomas Mraz Date: Mon, 5 Sep 2016 08:54:08 +0000 (+0200) Subject: On some machines the power supply is named ADP0. X-Git-Tag: cronie-1.5.2~36 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5a0597cd6a910fee401e365463f5bccf73494506;p=cronie On some machines the power supply is named ADP0. --- diff --git a/contrib/0anacron b/contrib/0anacron index 72a613d..027e8b7 100644 --- a/contrib/0anacron +++ b/contrib/0anacron @@ -8,7 +8,20 @@ if [ `date +%Y%m%d` = "$day" ]; then fi # Do not run jobs when on battery power -if [ `cat /sys/class/power_supply/AC/online 2>/dev/null`x = 0x ]; then +online=1 +for psupply in AC ADP0 ; do + sysfile="/sys/class/power_supply/$psupply/online" + + if [ -f $sysfile ] ; then + if [ `cat $sysfile 2>/dev/null`x = 1x ]; then + online=1 + break + else + online=0 + fi + fi +done +if [ $online = 0 ]; then exit 0 fi /usr/sbin/anacron -s