on some machines the power supply is named ADP0
This commit is contained in:
parent
a1d815b665
commit
2393c64c86
@ -1,8 +1,7 @@
|
||||
diff --git a/contrib/0anacron b/contrib/0anacron
|
||||
index 7bcb684..72a613d 100644
|
||||
--- a/contrib/0anacron
|
||||
+++ b/contrib/0anacron
|
||||
@@ -4,14 +4,11 @@ if test -r /var/spool/anacron/cron.daily; then
|
||||
diff -up cronie-1.5.1/contrib/0anacron.power cronie-1.5.1/contrib/0anacron
|
||||
--- cronie-1.5.1/contrib/0anacron.power 2013-01-17 14:04:09.000000000 +0100
|
||||
+++ cronie-1.5.1/contrib/0anacron 2016-09-05 10:53:50.000000000 +0200
|
||||
@@ -4,14 +4,24 @@ if test -r /var/spool/anacron/cron.daily
|
||||
day=`cat /var/spool/anacron/cron.daily`
|
||||
fi
|
||||
if [ `date +%Y%m%d` = "$day" ]; then
|
||||
@ -14,8 +13,21 @@ index 7bcb684..72a613d 100644
|
||||
-if test -x /usr/bin/on_ac_power; then
|
||||
- /usr/bin/on_ac_power >/dev/null 2>&1
|
||||
- if test $? -eq 1; then
|
||||
+if [ `cat /sys/class/power_supply/AC/online 2>/dev/null`x = 0x ]; then
|
||||
exit 0
|
||||
- fi
|
||||
- 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
|
||||
|
@ -6,7 +6,7 @@
|
||||
Summary: Cron daemon for executing programs at set times
|
||||
Name: cronie
|
||||
Version: 1.5.1
|
||||
Release: 2%{?dist}
|
||||
Release: 3%{?dist}
|
||||
License: MIT and BSD and ISC and GPLv2+
|
||||
Group: System Environment/Base
|
||||
URL: https://fedorahosted.org/cronie
|
||||
@ -204,6 +204,9 @@ exit 0
|
||||
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/cron.d/dailyjobs
|
||||
|
||||
%changelog
|
||||
* Mon Sep 5 2016 Tomáš Mráz <tmraz@redhat.com> - 1.5.1-3
|
||||
- on some machines the power supply is named ADP0
|
||||
|
||||
* Tue Aug 23 2016 Tomáš Mráz <tmraz@redhat.com> - 1.5.1-2
|
||||
- query power status directly from kernel
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user