]> git.pld-linux.org Git - packages/laptop-mode-tools.git/blame - laptop-mode-tools.init
- disable debug packages
[packages/laptop-mode-tools.git] / laptop-mode-tools.init
CommitLineData
617a52a0 1#!/bin/sh
2744053d 2#
617a52a0
AM
3# laptop-mode-tools
4#
5# chkconfig: 345 20 90
2744053d
ER
6#
7# description: laptop-mode-tools
8#
9# processname: laptop-mode-tools
10#
11# $Id$
617a52a0
AM
12
13# Source function library
14. /etc/rc.d/init.d/functions
15
2744053d
ER
16# Get service config - may override defaults
17[ -f /etc/sysconfig/laptop-mode-tools ] && . /etc/sysconfig/laptop-mode-tools
18
f6af4f9f 19start() {
617a52a0 20 # Check if the service is already running?
2744053d 21 if [ -f /var/lock/subsys/laptop-mode-tools ]; then
617a52a0 22 msg_already_running "laptop mode"
2744053d 23 return
617a52a0 24 fi
2744053d
ER
25
26 msg_starting "laptop mode"
27 touch /var/run/laptop-mode-tools/enabled
28 daemon /usr/sbin/laptop_mode auto
29 RETVAL=$?
30 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/laptop-mode-tools
f6af4f9f
ER
31}
32
33stop() {
2744053d 34 if [ ! -f /var/lock/subsys/laptop-mode-tools ]; then
617a52a0 35 msg_not_running "laptop mode"
2744053d 36 return
617a52a0 37 fi
2744053d
ER
38
39 # Stop daemons.
40 msg_stopping "laptop mode"
41 daemon /usr/sbin/laptop_mode stop
42 rm -f /var/lock/subsys/laptop-mode-tools /var/run/laptop-mode-tools/enabled
f6af4f9f
ER
43}
44
f14fb0fb 45condrestart() {
2744053d 46 if [ ! -f /var/lock/subsys/laptop-mode-tools ]; then
f14fb0fb
JB
47 msg_not_running "laptop mode"
48 RETVAL=$1
2744053d 49 return
f14fb0fb 50 fi
2744053d
ER
51
52 stop
53 # Remove files containing stored status, re-enable, and start it up again.
54 rm -rf /var/run/laptop-mode-tools/*
55 start
f14fb0fb
JB
56}
57
f6af4f9f
ER
58RETVAL=0
59# See how we were called.
60case "$1" in
61 start)
62 start
63 ;;
64 stop)
65 stop
617a52a0 66 ;;
f14fb0fb 67 restart)
f6af4f9f 68 stop
2744053d 69 # Remove files containing stored status, re-enable, and start it up again.
45d7b2e6 70 rm -fr /var/run/laptop-mode-tools/*
f6af4f9f 71 start
617a52a0 72 ;;
f14fb0fb
JB
73 try-restart)
74 condrestart 0
75 ;;
76 force-reload)
77 condrestart 7
78 ;;
617a52a0 79 status)
c3a77ef7 80 /usr/sbin/laptop_mode status
2744053d 81 RETVAL=$?
617a52a0
AM
82 ;;
83 *)
f14fb0fb 84 msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
617a52a0
AM
85 exit 3
86esac
87
88exit $RETVAL
This page took 0.714077 seconds and 4 git commands to generate.