Blame SOURCES/acpid.init

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