1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
#!/bin/sh
#
# Start or stop the Advanced Power Management daemon.
#
# Written by Dirk Eddelbuettel <edd@debian.org>
# Greatly modified by Avery Pennarun <apenwarr@debian.org>
#
# I think this script is now free of bashisms. Please correct me if I'm
# wrong!
PATH=/bin:/usr/bin:/sbin:/usr/sbin
test -s /usr/sbin/apmd || exit 0
test -e /proc/apm || exit 0
[ -f /etc/default/rcS ] && . /etc/default/rcS
# As apmd can be called with arguments, we use this variable to store these
# options as eg APMD="-w 5 -p 2". See the manual page apmd(8) for details.
APMD=""
# The $GMT variable in /etc/default/rcS is supposed to be blank or "-u" for
# UTC. But we can't be sure of this, so let's be more careful.
case "$GMT" in
*-u*|*--utc*)
APMGMT="-u"
;;
*)
APMGMT=""
;;
esac
case "$1" in
start)
echo -n "Starting advanced power management daemon: "
start-stop-daemon --start --quiet --exec /usr/sbin/apmd -- \
-s 'run-parts /etc/apm/suspend.d' \
-r 'run-parts /etc/apm/resume.d' $APMGMT $APMD
echo "apmd."
;;
stop)
echo -n "Stopping advanced power management daemon: "
start-stop-daemon --stop --quiet --oknodo --exec /usr/sbin/apmd
echo "apmd."
;;
restart|force-reload)
echo -n "Stopping advanced power management daemon: "
start-stop-daemon --stop --quiet --oknodo --exec /usr/sbin/apmd
echo "apmd."
echo -n "Starting advanced power management daemon: "
start-stop-daemon --start --quiet --exec /usr/sbin/apmd -- \
-s 'run-parts /etc/apm/suspend.d' \
-r 'run-parts /etc/apm/resume.d' $APMGMT $APMD
echo "apmd."
;;
*)
echo "Usage: /etc/init.d/apmd {start|stop|restart|force-reload}"
exit 1
esac
exit 0
|