Subversion Repositories configs

Rev

Rev 3 | Details | Compare with Previous | 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
 
63 - 24
# Source acpid configuration
25
[ -f /etc/sysconfig/acpid ] && . /etc/sysconfig/acpid
26
 
3 - 27
RETVAL=0
28
 
29
#
30
# See how we were called.
31
#
32
 
33
check() {
34
	# Check that we're a privileged user
35
	[ `id -u` = 0 ] || exit 4
36
 
37
	# Check if acpid is executable
38
	test -x /usr/sbin/acpid || exit 5
39
}
40
 
41
start() {
42
 
43
	check
44
 
45
	# Check for kernel support
46
	[ -f /proc/acpi/event ] || exit 1
47
 
48
	# Check if it is already running
49
	if [ ! -f /var/lock/subsys/acpid ]; then
50
		echo -n $"Starting acpi daemon: "
63 - 51
	    daemon /usr/sbin/acpid $OPTIONS
3 - 52
	    RETVAL=$?
53
	    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/acpid
54
	    echo
55
	fi
56
	return $RETVAL
57
}
58
 
59
stop() {
60
 
61
	check
62
 
63
	echo -n $"Stopping acpi daemon: "
64
	killproc /usr/sbin/acpid
65
	RETVAL=$?
66
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/acpid
67
	echo
68
    return $RETVAL
69
}
70
 
71
 
72
restart() {
73
	stop
74
	start
75
}
76
 
77
reload() {
78
 
79
	check
80
 
81
	trap "" SIGHUP
82
	action $"Reloading acpi daemon:" killall -HUP acpid
83
	RETVAL=$?
84
	return $RETVAL
85
}
86
 
87
case "$1" in
88
start)
89
	start
90
	;;
91
stop)
92
	stop
93
	;;
94
reload)
95
	reload
96
	;;
97
force-reload)
98
	echo "$0: Unimplemented feature."
99
	RETVAL=3
100
	;;
101
restart)
102
	restart
103
	;;
104
condrestart)
105
	if [ -f /var/lock/subsys/acpid ]; then
106
	    restart
107
	fi
108
	;;
109
status)
110
	status acpid
111
	RETVAL=$?
112
	;;
113
*)
114
	echo $"Usage: $0 {start|stop|status|restart|condrestart|reload|force-reload}"
115
	RETVAL=2
116
esac
117
 
118
exit $RETVAL