Blame SOURCES/acpid.init

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