Subversion Repositories configs

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 - 1
#!/bin/bash
2
#
3
#	/etc/rc.d/init.d/acpid
4
#
5
# Starts the acpi daemon
6
#
7
# chkconfig: 345 26 74
8
# description: Listen and dispatch ACPI events from the kernel
9
# processname: acpid
10
 
11
### BEGIN INIT INFO
12
# Provides: acpid
13
# Required-Start: $syslog $local_fs
14
# Required-Stop: $syslog $local_fs
15
# Default-Start:  2 3 4 5
16
# Default-Stop: 0 1 6
17
# Short-Description: start and stop acpid
18
# Description: Listen and dispatch ACPI events from the kernel
19
### END INIT INFO
20
 
21
# Source function library.
22
. /etc/rc.d/init.d/functions
23
 
24
RETVAL=0
25
 
26
#
27
# See how we were called.
28
#
29
 
30
check() {
31
	# Check that we're a privileged user
32
	[ `id -u` = 0 ] || exit 4
33
 
34
	# Check if acpid is executable
35
	test -x /usr/sbin/acpid || exit 5
36
}
37
 
38
start() {
39
 
40
	check
41
 
42
	# Check for kernel support
43
	[ -f /proc/acpi/event ] || exit 1
44
 
45
	# Check if it is already running
46
	if [ ! -f /var/lock/subsys/acpid ]; then
47
		echo -n $"Starting acpi daemon: "
48
	    daemon /usr/sbin/acpid
49
	    RETVAL=$?
50
	    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/acpid
51
	    echo
52
	fi
53
	return $RETVAL
54
}
55
 
56
stop() {
57
 
58
	check
59
 
60
	echo -n $"Stopping acpi daemon: "
61
	killproc /usr/sbin/acpid
62
	RETVAL=$?
63
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/acpid
64
	echo
65
    return $RETVAL
66
}
67
 
68
 
69
restart() {
70
	stop
71
	start
72
}
73
 
74
reload() {
75
 
76
	check
77
 
78
	trap "" SIGHUP
79
	action $"Reloading acpi daemon:" killall -HUP acpid
80
	RETVAL=$?
81
	return $RETVAL
82
}
83
 
84
case "$1" in
85
start)
86
	start
87
	;;
88
stop)
89
	stop
90
	;;
91
reload)
92
	reload
93
	;;
94
force-reload)
95
	echo "$0: Unimplemented feature."
96
	RETVAL=3
97
	;;
98
restart)
99
	restart
100
	;;
101
condrestart)
102
	if [ -f /var/lock/subsys/acpid ]; then
103
	    restart
104
	fi
105
	;;
106
status)
107
	status acpid
108
	RETVAL=$?
109
	;;
110
*)
111
	echo $"Usage: $0 {start|stop|status|restart|condrestart|reload|force-reload}"
112
	RETVAL=2
113
esac
114
 
115
exit $RETVAL