Linux apm daemon
This daemon is an advanced power management (APM) daemon and works in conjunction with the APM BIOS driver in the kernel. It can execute a command when certain events are reported by the driver.
Most uses of this daemon will use the proxy command to support power conservation activities. This command is searched for in "/etc/apmd/apmd_proxy" and is invoked with one or two arguments.
- start
- stop
- suspend
- standby
- resume
- change power
- change battery
- change capability
The apmd startup script
|
|
This script sets the apmd daemon configuration file at "/etc/sysconfig/apmd". It sets clock options depending on whether the local or universal time is being used. This is determined by the contents of the file "/etc/sysconfig/clock". The apmd options are controlled by the contents of the file "/etc/sysconfig/apmd".
#!/bin/sh
#
# chkconfig: 2345 16 84
# description: apmd is used for monitoring battery status and logging it via \
# syslog(8). It can also be used for shutting down the machine when \
# the battery is low.
# processname: apmd
# config: /etc/sysconfig/apmd
# clock: /etc/sysconfig/clock
# Don't bother if /proc/apm doesn't exist, kernel has not support for APM.
[ -e /proc/apm ] || exit 0
CONFIG=/etc/sysconfig/apmd
# Source function library.
. /etc/rc.d/init.d/functions
# Source time clock options
CLOCK=/etc/sysconfig/clock
RETVAL=0
# See how we were called.
case "$1" in
start)
echo -n "Starting up APM daemon: "
test -r "$CONFIG" && . "$CONFIG"
test -r "$CLOCK" && . "$CLOCK"
if [ "$UTC" = true -o "$UTC" = yes ]; then
APMD_OPTIONS="$APMD_OPTIONS -u"
fi
daemon /usr/sbin/apmd "$APMD_OPTIONS"
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/apmd
echo
;;
stop)
echo -n "Shutting down APM daemon: "
killproc apmd
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/apmd
echo
;;
status)
status apmd
RETVAL=$?
;;
restart|reload)
$0 stop
$0 start
RETVAL=$?
;;
*)
echo "Usage: apmd.init {start|stop|status|restart|reload}"
exit 1
esac
exit $RETVAL
|