File: init-script

package info (click to toggle)
pwrkap 7.30-5
  • links: PTS, VCS
  • area: main
  • in suites: buster, jessie, jessie-kfreebsd, squeeze, stretch, wheezy
  • size: 464 kB
  • ctags: 491
  • sloc: python: 3,667; makefile: 134; sh: 101
file content (59 lines) | stat: -rwxr-xr-x 1,289 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash
#
# pwrkap	This shell script takes care of starting and stopping
#		pwrkap
#
# chkconfig: - 20 70
# description: pwrkap monitors energy use and controls power use.
# processname: pwrkap_main.py
# (C) Copyright IBM Corp. 2008-2009
# Licensed under the GPLv2.

### BEGIN INIT INFO
# Provides:       pwrkap
# Required-Start: 
# Should-Start: 
# Required-Stop:
# Default-Start:  3 5
# Default-Stop:
# Description:    start pwrkap
### END INIT INFO

# Source function library.
[ -e /etc/init.d/functions ] && . /etc/init.d/functions #rhel5
[ -e /etc/rc.status ] && . /etc/rc.status #sles10

PATH="/sbin:/bin:/usr/sbin:/usr/bin"

[ -x /usr/bin/pwrkap_main ] || exit 0

case "$1" in
start)
    /usr/bin/pwrkap_main
    ;;
stop)
    ps ax | grep -v grep | grep pwrkap_main.py | while read pid junk; do kill $pid; done
    ;;
restart|force-reload)
    $0 stop
    $0 start
    ;;
status)
    PWRKAPS=`ps ax | grep -v grep | grep pwrkap_main.py -c`
    if [ $PWRKAPS -lt 1 ]; then
        echo "pwrkap is not running."
    elif [ $PWRKAPS -gt 1 ]; then
        echo "Multiple copies of pwrkap are running.  Turn some of them off."
    else
        echo "pwrkap is running."
    fi
    ;;
 
*)
    echo "Usage: $0 {start|stop|restart|force-reload|status}"
    exit 1
    ;;
esac

exit 0