]> git.pld-linux.org Git - packages/laptop-mode-tools.git/blame - laptop-mode-tools.init
- changes made by Paweł Żuk <redstorm14 at gmail dot com>, thanks
[packages/laptop-mode-tools.git] / laptop-mode-tools.init
CommitLineData
617a52a0
AM
1#!/bin/sh
2# laptop-mode-tools
3#
4# chkconfig: 345 20 90
5# description: laptop-mode-tools
6
7# Source function library
8. /etc/rc.d/init.d/functions
9
f6af4f9f 10start() {
617a52a0
AM
11 # Check if the service is already running?
12 if [ ! -f /var/lock/subsys/laptop-mode-tools ]; then
13 msg_starting "laptop mode"
45d7b2e6 14 touch /var/run/laptop-mode-tools/enabled
617a52a0
AM
15 daemon /usr/sbin/laptop_mode auto
16 RETVAL=$?
17 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/laptop-mode-tools
18 else
19 msg_already_running "laptop mode"
20 fi
f6af4f9f
ER
21}
22
23stop() {
617a52a0
AM
24 if [ -f /var/lock/subsys/laptop-mode-tools ]; then
25 msg_stopping "laptop mode"
26 daemon /usr/sbin/laptop_mode stop
45d7b2e6 27 rm -f /var/lock/subsys/laptop-mode-tools /var/run/laptop-mode-tools/enabled
617a52a0
AM
28 else
29 msg_not_running "laptop mode"
30 fi
f6af4f9f
ER
31}
32
f14fb0fb
JB
33condrestart() {
34 if [ -f /var/lock/subsys/laptop-mode-tools ]; then
35 stop
45d7b2e6
SP
36 # Now remove files containing stored status, re-enable, and start it up again.
37 rm -fr /var/run/laptop-mode-tools/*
f14fb0fb
JB
38 start
39 else
40 msg_not_running "laptop mode"
41 RETVAL=$1
42 fi
43}
44
f6af4f9f
ER
45RETVAL=0
46# See how we were called.
47case "$1" in
48 start)
49 start
50 ;;
51 stop)
52 stop
617a52a0 53 ;;
f14fb0fb 54 restart)
f6af4f9f 55 stop
45d7b2e6
SP
56 # Now remove files containing stored status, re-enable, and start it up again.
57 rm -fr /var/run/laptop-mode-tools/*
f6af4f9f 58 start
617a52a0 59 ;;
f14fb0fb
JB
60 try-restart)
61 condrestart 0
62 ;;
63 force-reload)
64 condrestart 7
65 ;;
617a52a0 66 status)
c3a77ef7 67 /usr/sbin/laptop_mode status
617a52a0
AM
68 exit $?
69 ;;
70 *)
f14fb0fb 71 msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
617a52a0
AM
72 exit 3
73esac
74
75exit $RETVAL
This page took 0.113867 seconds and 4 git commands to generate.