blob: 45770b071076672a5d5ac532305fb4421f2c4875 (
plain)
1 #!/bin/sh
2 #@ acpid2 startup script.
3
4 RD=/var/run
5 CONFDIR=/etc/acpi/events
6 PID=${RD}/acpid.pid
7 LCK=${RD}/acpid.lck
8 SCK=${RD}/acpid.socket
9
10 SSD=/sbin/start-stop-daemon
11 PROG=/usr/sbin/acpid
12 OPTS="-c ${CONFDIR} -L ${LCK} -p ${PID} -s ${SCK}"
13
14 case "${1}" in
15 start)
16 exec "${SSD}" --start --pidfile "${PID}" --exec "${PROG}" -- ${OPTS}
17 ;;
18 stop)
19 "${SSD}" --stop --retry 10 --pidfile "${PID}" --exec "${PROG}"
20 e=${?}
21 [ ${e} -eq 0 ] && rm -f ${RD}/acpid.socket
22 exit ${e}
23 ;;
24 reload)
25 "${SSD}" --status --pidfile "${PID}" --exec "${PROG}" &&
26 kill -HUP $(cat ${PID})
27 ;;
28 restart)
29 "${SSD}" --status --pidfile "${PID}" --exec "${PROG}" && "${0}" stop
30 exec "${0}" start
31 ;;
32 status)
33 "${SSD}" --status --pidfile "${PID}" --exec "${PROG}"
34 e=${?}
35 case ${e} in
36 0) echo "${PROG} is running with pid $(cat ${PID})";;
37 1) echo "${PROG} is not running but the pid file ${PID} exists";;
38 3) echo "${PROG} is not running";;
39 4) echo "Unable to determine the program status";;
40 esac
41 exit ${e}
42 ;;
43 *)
44 echo "usage: ${0} start|stop|reload|restart|status"
45 ;;
46 esac
|