#!/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 ### BEGIN INIT INFO # Provides: acpid # Required-Start: $syslog $local_fs # Required-Stop: $syslog $local_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: start and stop acpid # Description: Listen and dispatch ACPI events from the kernel ### END INIT INFO # Source function library. . /etc/rc.d/init.d/functions RETVAL=0 # # See how we were called. # start() { # Check if it is already running if [ ! -f /var/lock/subsys/acpid ]; then # Check if acpid is executable if [ ! -x /usr/sbin/acpid ]; then logger -p daemon.error -t $0 "/usr/sbin/acpid is not executable." exit 1 fi # Check for kernel support if [ ! -f /proc/acpi/event ]; then logger -p daemon.error -t $0 "need ACPI_PROC_EVENT support in kernel." exit 1 fi echo -n $"Starting acpi daemon: " daemon /usr/sbin/acpid $@ RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/acpid echo fi return $RETVAL } stop() { echo -n $"Stopping acpi daemon: " killproc /usr/sbin/acpid RETVAL=$? [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/acpid echo return $RETVAL } restart() { stop start $@ } reload() { trap "" SIGHUP action $"Reloading acpi daemon:" killall -HUP acpid RETVAL=$? return $RETVAL } case "$1" in start) start $2 ;; stop) stop ;; reload) reload ;; force-reload) echo "$0: Unimplemented feature." RETVAL=3 ;; restart) restart $2 ;; condrestart) if [ -f /var/lock/subsys/acpid ]; then restart $2 fi ;; status) status acpid RETVAL=$? ;; *) echo $"Usage: $0 {start|stop|status|restart|condrestart|reload|force-reload}" RETVAL=2 esac exit $RETVAL