Blame SOURCES/acpid.init

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