]> git.pld-linux.org Git - packages/acpid.git/blob - acpid.init
2717692126655e510603d6a68fccbd3a530fb62b
[packages/acpid.git] / acpid.init
1 #!/bin/sh
2 #
3 # acpid         Starts the acpi daemon
4 #
5 # chkconfig:    345 44 56
6 # description:  Listen and dispatch ACPI events from the kernel
7 # processname:  acpid
8 #
9 # pidfile:      /var/run/acpid.pid
10
11 # Source function library.
12 . /etc/rc.d/init.d/functions
13
14 # Initial values (just in case):
15 LAPTOP_MODULES=""
16 VARIOUS_MODULES=""
17 ASUS_LAPTOP=""
18 TOSHIBA_LAPTOP=""
19
20 # Configuration file.
21 . /etc/sysconfig/acpid
22
23
24 RETVAL=0
25 # See how we were called.
26 case "$1" in
27   start)
28         # Start daemons.
29         if [ ! -f /var/lock/subsys/acpid ]; then
30                 if [ ! -d /proc/acpi/button ]; then
31                         _modprobe ospm_button
32                         _modprobe button
33                 fi
34                 if is_yes "$MODPROBE_OSPM_SYSTEM"; then
35                         _modprobe single ospm_system
36                 fi
37                 # Load additional modules:
38                 if [ -n "$LAPTOP_MODULES" ]; then
39                         for i in "$LAPTOP_MODULES"; do
40                                 _modprobe single $i
41                         done
42                 elif [ -n "$VARIOUS_MODULES" ]; then
43                         for i in "$VARIOUS_MODULES"; do
44                                 _modprobe single $i
45                         done
46                 fi
47                 # Determine if it's ASUS or TOSHIBA laptop
48                 if is_yes "$ASUS_LAPTOP"; then
49                         _modprobe asus_acpi
50                 elif is_yes "$TOSHIBA_LAPTOP"; then
51                         _modprobe toshiba_acpi
52                 fi
53                 # starting:
54                 msg_starting acpid $PROGRAM_ARGS
55                 daemon acpid
56                 RETVAL=$?
57                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/acpid
58         else
59                 msg_already_running acpid
60         fi
61         ;;
62   stop)
63         # Stop daemons.
64         if [ -f /var/lock/subsys/acpid ]; then
65                 msg_stopping acpid
66                 killproc acpid
67                 rm -f /var/lock/subsys/acpid >/dev/null 2>&1
68         else
69                 msg_not_running acpid
70         fi
71         ;;
72   reload|force-reload)
73         if [ -f /var/lock/subsys/acpid ]; then
74                 msg_reloading acpid
75                 killproc acpid -HUP
76                 RETVAL=$?
77         else
78                 msg_not_running acpid >&2
79                 exit 7
80         fi
81         ;;
82   restart)
83         $0 stop
84         $0 start
85         exit $?
86         ;;
87   status)
88         status acpid
89         exit $?
90         ;;
91   *)
92         msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
93         exit 3
94 esac
95
96 exit $RETVAL
This page took 0.061649 seconds and 2 git commands to generate.