~ubuntu-branches/ubuntu/dapper/cpufreqd/dapper

« back to all changes in this revision

Viewing changes to scripts/mandrake/cpufreqd.init.mdk

  • Committer: Bazaar Package Importer
  • Author(s): Mattia Dongili
  • Date: 2005-11-27 18:47:42 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051127184742-9h26euwetr6kh1e6
Tags: 2.0.0-1

* New upstream release.
* cpufreqd.init: exit succesfully in case a stop is issued and
  cpufreqd is found running as requested by LSB thus making it
  possible to remove cpufreqd when cpufreqd itsef is stopped
  (closes: #340133)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/bash
2
 
#
3
 
# Init file for cpufreqd
4
 
#
5
 
# chkconfig: 2345 65 35
6
 
# description: cpufreqd - CPU frequency scaling daemon \
7
 
# cpufreqd is meant to be a replacement of the speedstep applet you \
8
 
# can find on some other OS, it monitors battery level, AC state and \
9
 
# running programs and adjusts the frequency of the processor according to \
10
 
# a set of rules specified in the config file (see cpufreqd.conf (5)). \
11
 
# processname: cpufreqd
12
 
# pidfile: /var/run/arpd.pid
13
 
 
14
 
 
15
 
 
16
 
# Source function library.
17
 
. /etc/rc.d/init.d/functions
18
 
 
19
 
RETVAL=0
20
 
 
21
 
[ -d /sys/devices/system/cpu/cpu0/cpufreq ] || [ -f /proc/cpufreq ] || exit 0
22
 
 
23
 
 
24
 
start() {
25
 
        gprintf "Starting cpufreqd : "
26
 
        daemon cpufreqd
27
 
 
28
 
        RETVAL=$?
29
 
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/cpufreqd
30
 
        echo
31
 
        return $RETVAL
32
 
}
33
 
        
34
 
stop() {
35
 
        gprintf "Stopping cpufreqd : "
36
 
        killproc cpufreqd
37
 
        RETVAL=$?
38
 
        [ $RETVAL = 0 ] && rm -f /var/lock/subsys/cpufreqd
39
 
        echo
40
 
        return $RETVAL
41
 
}
42
 
 
43
 
restart() {
44
 
        stop
45
 
        start
46
 
}
47
 
 
48
 
        
49
 
case "$1" in
50
 
        start)
51
 
                start
52
 
                ;;
53
 
        stop)
54
 
                stop
55
 
                ;;
56
 
        restart|reload)
57
 
                restart
58
 
                ;;
59
 
        condrestart)
60
 
                if [ -f /var/log/subsys/cpufreqd ]; then
61
 
                        restart
62
 
                fi
63
 
                ;;      
64
 
        status)
65
 
                status cpufreqd
66
 
                ;;
67
 
        *)
68
 
                gprintf "Usage: %s {start|stop|restart|condrestart|status}\n" `basename $0`
69
 
                RETVAL=1
70
 
                ;;
71
 
 
72
 
esac
73
 
 
74
 
exit $RETVAL