]> Frank Brehm's Git Trees - config/berta/etc.git/commitdiff
saving uncommitted changes in /etc prior to emerge run
authorFrank Brehm <frank@brehm-online.com>
Mon, 11 Feb 2019 10:46:26 +0000 (11:46 +0100)
committerFrank Brehm <frank@brehm-online.com>
Mon, 11 Feb 2019 10:46:26 +0000 (11:46 +0100)
cron.hourly/0anacron

index 7bcb684bf9994d3ae0aab099696ce4ee7967497e..027e8b711a9cc6fa0c4e5f9e4a3d273ed363c9b2 100755 (executable)
@@ -4,14 +4,24 @@ 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;
+    exit 0
 fi
 
 # Do not run jobs when on battery power
-if test -x /usr/bin/on_ac_power; then
-    /usr/bin/on_ac_power >/dev/null 2>&1
-    if test $? -eq 1; then
-    exit 0
+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