]> git.pld-linux.org Git - packages/cpudyn.git/blob - cpudyn.init
- tabs in preamble
[packages/cpudyn.git] / cpudyn.init
1 #! /bin/sh
2 #
3 #               Written by Celso Gonzalez <celso@bulma.net>.
4 #
5 #               based in skeleton example file provided by Debian.
6 #
7 # Version:      @(#)cpudyn  0.4.0  30-Jul-2003  celso@bulma.net
8 #
9
10 PATH=/sbin:/bin:/usr/sbin:/usr/bin
11 DAEMON=/sbin/cpudynd
12 NAME=cpudyn
13 DESC=cpudyn
14 CONFFILE=/etc/cpudyn.conf
15 PIDFILE=/var/run/$NAME.pid
16
17 test -x $DAEMON || exit 0
18 test -e $CONFFILE || exit 0
19
20 # Read the configuration file
21 . $CONFFILE
22
23 OPTS=""
24 if [ ! -z "$INTERVAL" ]; then OPTS="$OPTS -i $INTERVAL"; fi
25 if [ ! -z "$CPU_UP" -a ! -z "$CPU_DOWN" ]; then OPTS="$OPTS -p $CPU_UP $CPU_DOWN"; fi
26 if [ ! -z "$THROTTLING_LOW" ]; then OPTS="$OPTS -l $THROTTLING_LOW"; fi
27 if [ ! -z "$TIMEOUT" ]; then OPTS="$OPTS -t $TIMEOUT"; fi
28 if [ ! -z "$DISKS" ]; then OPTS="$OPTS -h $DISKS"; fi
29
30 set -e
31
32 case "$1" in
33   start)
34         echo -n "Starting $DESC: "
35         start-stop-daemon --start --quiet --pidfile $PIDFILE \
36                 --background --make-pidfile --exec $DAEMON -- $OPTS
37         echo "$NAME."
38         ;;
39   stop)
40         echo -n "Stopping $DESC: "
41         start-stop-daemon --stop --quiet --pidfile $PIDFILE \
42                 --exec $DAEMON && rm -f $PIDFILE
43         echo "$NAME."
44         ;;
45   restart|force-reload)
46         echo -n "Restarting $DESC: "
47         start-stop-daemon --stop --quiet --pidfile $PIDFILE \
48                 --exec $DAEMON && rm -f $PIDFILE
49         sleep 1
50         start-stop-daemon --start --quiet --pidfile $PIDFILE \
51                 --background --make-pidfile --exec $DAEMON -- $OPTS
52         echo "$NAME."
53         ;;
54   *)
55         N=/etc/init.d/$NAME
56         echo "Usage: $N {start|stop|restart|force-reload}" >&2
57         exit 1
58         ;;
59 esac
60
61 exit 0
This page took 0.088055 seconds and 3 git commands to generate.