Blame SOURCES/acpid.init

7da3f6
#!/bin/bash
7da3f6
#
7da3f6
#	/etc/rc.d/init.d/acpid
7da3f6
#
7da3f6
# Starts the acpi daemon
7da3f6
#
7da3f6
# chkconfig: 345 26 74
7da3f6
# description: Listen and dispatch ACPI events from the kernel
7da3f6
# processname: acpid
7da3f6
7da3f6
### BEGIN INIT INFO
7da3f6
# Provides: acpid
7da3f6
# Required-Start: $syslog $local_fs
7da3f6
# Required-Stop: $syslog $local_fs
7da3f6
# Default-Start:  2 3 4 5
7da3f6
# Default-Stop: 0 1 6
7da3f6
# Short-Description: start and stop acpid
7da3f6
# Description: Listen and dispatch ACPI events from the kernel
7da3f6
### END INIT INFO
7da3f6
7da3f6
# Source function library.
7da3f6
. /etc/rc.d/init.d/functions
7da3f6
7da3f6
# Source networking configuration.
7da3f6
. /etc/sysconfig/acpid
7da3f6
7da3f6
RETVAL=0
7da3f6
7da3f6
#
7da3f6
# See how we were called.
7da3f6
#
7da3f6
7da3f6
check() {
7da3f6
	# Check that we're a privileged user
7da3f6
	[ `id -u` = 0 ] || exit 4
7da3f6
	
7da3f6
	# Check if acpid is executable
7da3f6
	test -x /usr/sbin/acpid || exit 5
7da3f6
}
7da3f6
7da3f6
start() {
7da3f6
7da3f6
	check
7da3f6
	
7da3f6
	# Check if it is already running
7da3f6
	if [ ! -f /var/lock/subsys/acpid ]; then
7da3f6
		echo -n $"Starting acpi daemon: "	
7da3f6
	    daemon /usr/sbin/acpid $OPTIONS
7da3f6
	    RETVAL=$?
7da3f6
	    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/acpid
7da3f6
	    echo
7da3f6
	fi
7da3f6
	return $RETVAL
7da3f6
}
7da3f6
7da3f6
stop() {
7da3f6
7da3f6
	check
7da3f6
	
7da3f6
	echo -n $"Stopping acpi daemon: "
7da3f6
	killproc /usr/sbin/acpid
7da3f6
	RETVAL=$?
7da3f6
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/acpid
7da3f6
	echo
7da3f6
    return $RETVAL
7da3f6
}
7da3f6
7da3f6
7da3f6
restart() {
7da3f6
	stop
7da3f6
	start
7da3f6
}	
7da3f6
7da3f6
reload() {
7da3f6
7da3f6
	check
7da3f6
	
7da3f6
	trap "" SIGHUP
7da3f6
	action $"Reloading acpi daemon:" killall -HUP acpid
7da3f6
	RETVAL=$?
7da3f6
	return $RETVAL
7da3f6
}	
7da3f6
7da3f6
case "$1" in
7da3f6
start)
7da3f6
	start
7da3f6
	;;
7da3f6
stop)
7da3f6
	stop
7da3f6
	;;
7da3f6
reload)
7da3f6
	reload
7da3f6
	;;
7da3f6
force-reload)
7da3f6
	echo "$0: Unimplemented feature."
7da3f6
	RETVAL=3
7da3f6
	;;
7da3f6
restart)
7da3f6
	restart
7da3f6
	;;
7da3f6
condrestart)
7da3f6
	if [ -f /var/lock/subsys/acpid ]; then
7da3f6
	    restart
7da3f6
	fi
7da3f6
	;;
7da3f6
status)
7da3f6
	status acpid
7da3f6
	RETVAL=$?
7da3f6
	;;
7da3f6
*)
7da3f6
	echo $"Usage: $0 {start|stop|status|restart|condrestart|reload|force-reload}"
7da3f6
	RETVAL=2
7da3f6
esac
7da3f6
7da3f6
exit $RETVAL