4 # Required-Start: $syslog
5 # Required-Stop: $syslog
6 # Should-Start: $local_fs
7 # Should-Stop: $local_fs
8 # Default-Start: 2 3 4 5
10 # Short-Description: Start the Advanced Configuration and Power Interface daemon
11 # Description: Provide a socket for X11, hald and others to multiplex
15 # Check for daemon presence
16 test -x /usr
/sbin
/acpid ||
exit 0
18 # Check for ACPI support on kernel side
19 [ -d /proc
/acpi
] ||
exit 0
21 # Include acpid defaults if available
23 if [ -f /etc
/default
/acpid
] ; then
28 [ -r /lib
/lsb
/init-functions
] && .
/lib
/lsb
/init-functions
29 [ -r /etc
/default
/rcS
] && .
/etc
/default
/rcS
31 if [ "x$VERBOSE" = "xno" ]; then
32 MODPROBE_OPTIONS
="$MODPROBE_OPTIONS -q"
33 export MODPROBE_OPTIONS
36 # As the name says. If the kernel supports modules, it'll try to load
37 # the ones listed in "MODULES".
39 LIST
=`/sbin/lsmod|awk '!/Module/ {print $1}'`
41 # Get list of available modules
42 LOC
="/lib/modules/`uname -r`/kernel/drivers/acpi"
44 MODAVAIL
=`( find $LOC -type f -name "*.o"; \
45 find $LOC -type f -name "*.ko") | /bin/sed -e 's,.*/,,g' -e 's,\.ko,,g' -e 's,\.o,,g'`
50 if [ "$MODULES" = "all" ]; then
54 if [ -n "$MODULES" ]; then
55 echo "Loading ACPI modules..."
57 for mod
in $MODULES; do
58 echo $MODAVAIL |
grep -q -w "$mod" ||
continue
59 if echo $LIST |
grep -q -w "$mod"; then
60 [ "$VERBOSE" != no
] && echo "Module already loaded: $mod"
62 if modprobe
$mod 2>/dev
/null
; then
63 [ "$VERBOSE" != no
] && echo "Loaded module: $mod"
65 if [ "$VERBOSE" != no
]; then
66 echo "Unable to load module: $mod"
77 [ -f /proc
/modules
] && load_modules
78 echo "Starting Advanced Configuration and Power Interface daemon..."
79 start-stop-daemon
-S -q -x /usr
/sbin
/acpid
-- -c /etc
/acpi
/events
$OPTIONS
83 echo "Stopping Advanced Configuration and Power Interface daemon..."
84 #start-stop-daemon -K -q -o -R 2 -x /usr/sbin/acpid
85 start-stop-daemon
-K -q -x /usr
/sbin
/acpid
98 echo "Usage: /etc/init.d/acpid {start|stop|restart|reload|force-reload}"