]> git.pld-linux.org Git - packages/apmd.git/blob - apmd.init
- missing pl descriptions, fixed deps
[packages/apmd.git] / apmd.init
1 #!/bin/sh
2 #
3 # chkconfig:    2345 35 65
4 # description:  apmd is used for monitoring batery status and logging it via \
5 #               syslog(8). It can also be used for shutting down the machine when \
6 #               the battery is low.
7 # processname:  apmd
8 # config:       /etc/sysconfig/apmd
9
10 # Source function library.
11 . /etc/rc.d/init.d/functions
12
13 no_kernel_supp() {
14         echo $(nls "No kernel APM support")'!'
15         exit 1
16 }
17
18 if [ ! -f /proc/apm ]; then
19         modprobe apm || no_kernel_supp
20 fi
21
22 CONFIG=/etc/sysconfig/apmd
23
24 RETVAL=0
25 # See how we were called.
26 case "$1" in
27   start)
28         # Check if the service is already running?
29         if [ ! -f /var/lock/subsys/apmd ]; then
30                 msg_starting APM
31                 [ -r "$CONFIG" ] && . "$CONFIG"
32                 daemon apmd "$APMD_OPTIONS"
33                 RETVAL=$?
34                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/apmd
35         else
36                 msg_already_running APM
37         fi
38         ;;
39   stop)
40         if [ -f /var/lock/subsys/apmd ]; then
41                 msg_stopping APM
42                 killproc apmd
43                 rm -f /var/lock/subsys/apmd
44         else
45                 msg_not_running APM
46         fi
47         ;;
48   status)
49         status apmd
50         exit $?
51         ;;
52   restart|force-reload)
53         $0 stop
54         $0 start
55         exit $?
56         ;;
57   *)
58         msg_usage "$0 {start|stop|restart|force-reload|status}"
59         exit 3
60 esac
61
62 exit $RETVAL
This page took 0.075149 seconds and 3 git commands to generate.