Sophie

Sophie

distrib > Mageia > 1 > i586 > media > core-updates-src > by-pkgid > 66b502aeec02866040b94385068cb374 > files > 4

acpid-2.0.9-1.1.mga1.src.rpm

#!/bin/bash
#
#	/etc/rc.d/init.d/acpid
#
# Starts the acpi daemon
#
# chkconfig: 3457 14 56
# description: Listen and dispatch ACPI events from the kernel
# processname: acpid
# securlevel: 80
#
### BEGIN INIT INFO
# Provides: acpid
# Default-Start: 3 4 5 7
# Short-Description: Starts the acpi daemon
# Description: Listen and dispatch ACPI events from the kernel
### END INIT INFO

# Source function library.
. /etc/rc.d/init.d/functions

DAEMON=acpi
PROGNAME=${DAEMON}d
test -x /usr/sbin/$PROGNAME || exit 0
test -f /proc/acpi/event || exit 0

RETVAL=0

#
# See how we were called.
#

start() {
	# Check if it is already running
	if [ ! -f /var/lock/subsys/$PROGNAME ]; then
	    echo -n "Starting $DAEMON daemon: "
	    daemon /usr/sbin/$PROGNAME
	    RETVAL=$?
	    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$PROGNAME
	    echo
	fi
	return $RETVAL
}

stop() {
	echo -n "Stopping $DAEMON daemon: "
	killproc /usr/sbin/$PROGNAME
	RETVAL=$?
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$PROGNAME
	echo
        return $RETVAL
}


restart() {
	stop
	start
}	

reload() {
	trap "" SIGHUP
	killall -HUP $PROGNAME
}	

case "$1" in
start)
	start
	;;
stop)
	stop
	;;
reload)
	reload
	;;
restart)
	restart
	;;
condrestart)
	if [ -f /var/lock/subsys/$PROGNAME ]; then
	    restart
	fi
	;;
status)
	status $PROGNAME
	;;
*)
	INITNAME=`basename $0`
	echo "Usage: $INITNAME {start|stop|restart|condrestart|status}"
	exit 1
esac

exit $RETVAL