85 lines
1.2 KiB
Plaintext
85 lines
1.2 KiB
Plaintext
|
#!/bin/bash
|
||
|
#
|
||
|
# /etc/rc.d/init.d/acpid
|
||
|
#
|
||
|
# Starts the acpi daemon
|
||
|
#
|
||
|
# chkconfig: 345 44 56
|
||
|
# description: Listen and dispatch ACPI events from the kernel
|
||
|
# processname: acpid
|
||
|
|
||
|
# Source function library.
|
||
|
. /etc/rc.d/init.d/functions
|
||
|
|
||
|
DAEMON=acpi
|
||
|
PROGNAME=${DAEMON}d
|
||
|
[ -x /usr/sbin/acpid ] || exit 0
|
||
|
[ -f /proc/acpi/event ] || exit 0
|
||
|
|
||
|
RETVAL=0
|
||
|
|
||
|
#
|
||
|
# See how we were called.
|
||
|
#
|
||
|
|
||
|
start() {
|
||
|
# Check if it is already running
|
||
|
if [ ! -f /var/lock/subsys/$PROGNAME ]; then
|
||
|
echo -n $"Starting acpi daemon: "
|
||
|
modprobe button > /dev/null 2>&1
|
||
|
daemon /usr/sbin/$PROGNAME
|
||
|
RETVAL=$?
|
||
|
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$PROGNAME
|
||
|
echo
|
||
|
fi
|
||
|
return $RETVAL
|
||
|
}
|
||
|
|
||
|
stop() {
|
||
|
echo -n "Stopping $DAEMON daemon: "
|
||
|
killproc /usr/sbin/$PROGNAME
|
||
|
RETVAL=$?
|
||
|
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$PROGNAME
|
||
|
echo
|
||
|
return $RETVAL
|
||
|
}
|
||
|
|
||
|
|
||
|
restart() {
|
||
|
stop
|
||
|
start
|
||
|
}
|
||
|
|
||
|
reload() {
|
||
|
trap "" SIGHUP
|
||
|
killall -HUP $PROGNAME
|
||
|
}
|
||
|
|
||
|
case "$1" in
|
||
|
start)
|
||
|
start
|
||
|
;;
|
||
|
stop)
|
||
|
stop
|
||
|
;;
|
||
|
reload)
|
||
|
reload
|
||
|
;;
|
||
|
restart)
|
||
|
restart
|
||
|
;;
|
||
|
condrestart)
|
||
|
if [ -f /var/lock/subsys/$PROGNAME ]; then
|
||
|
restart
|
||
|
fi
|
||
|
;;
|
||
|
status)
|
||
|
status $PROGNAME
|
||
|
;;
|
||
|
*)
|
||
|
echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}"
|
||
|
exit 1
|
||
|
esac
|
||
|
|
||
|
exit $RETVAL
|