~upstart-devel/upstart/upstart-jobs

« back to all changes in this revision

Viewing changes to vivid/etc/init.d/battery-stats

  • Committer: Dimitri John Ledkov
  • Date: 2014-11-19 12:58:41 UTC
  • Revision ID: dimitri.j.ledkov@intel.com-20141119125841-98dr37roy8dvcv3b
auto update

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh
 
2
### BEGIN INIT INFO
 
3
# Provides:          battery-stats
 
4
# Required-Start:    $remote_fs $syslog
 
5
# Required-Stop:     $remote_fs $syslog
 
6
# Default-Start:     2 3 4 5
 
7
# Default-Stop:      0 1 6
 
8
# Short-Description: start/stop the battery statistics collector
 
9
### END INIT INFO
 
10
#
 
11
# Based on skeleton written by Miquel van Smoorenburg <miquels@cistron.nl>.
 
12
# Modified for Debian GNU/Linux by Ian Murdock <imurdock@gnu.ai.mit.edu>.
 
13
# Modified for battery-stats by Karl E. Jørgensen <karl@jorgensen.com>
 
14
 
 
15
PATH=/sbin:/bin:/usr/sbin:/usr/bin
 
16
DAEMON=/usr/sbin/battery-stats-collector
 
17
NAME=battery-stats-collector
 
18
DESC="Battery statistics collector"
 
19
 
 
20
# Please use /etc/battery-stats.conf to override these parameters.
 
21
SYS_ARGS="--syslog --output /var/log/battery-stats"
 
22
ARGS="--interval=60 --flush=10 --ignore-missing-battery"
 
23
 
 
24
CONFIG=/etc/battery-stats.conf
 
25
 
 
26
test -f $DAEMON || exit 0
 
27
 
 
28
set -e
 
29
 
 
30
if [ -f $CONFIG ]
 
31
then
 
32
    . $CONFIG
 
33
fi
 
34
 
 
35
case "$1" in
 
36
  start)
 
37
        echo -n "Starting $DESC: "
 
38
        start-stop-daemon --background --make-pidfile --start --quiet \
 
39
                --pidfile /var/run/$NAME.pid \
 
40
                --exec $DAEMON -- $SYS_ARGS $ARGS
 
41
        echo "$NAME."
 
42
        ;;
 
43
  stop)
 
44
        echo -n "Stopping $DESC: "
 
45
        start-stop-daemon --oknodo --stop --quiet --pidfile /var/run/$NAME.pid \
 
46
                --exec $DAEMON
 
47
        echo "$NAME."
 
48
        ;;
 
49
  reload|restart|force-reload)
 
50
        #
 
51
        #       If the "reload" option is implemented, move the "force-reload"
 
52
        #       option to the "reload" entry above. If not, "force-reload" is
 
53
        #       just the same as "restart".
 
54
        #
 
55
        echo -n "Restarting $DESC: "
 
56
        start-stop-daemon --stop --quiet --pidfile \
 
57
                /var/run/$NAME.pid --exec $DAEMON
 
58
        sleep 1
 
59
        start-stop-daemon --background --make-pidfile --start --quiet \
 
60
                --pidfile /var/run/$NAME.pid \
 
61
                --exec $DAEMON -- $SYS_ARGS $ARGS
 
62
        echo "$NAME."
 
63
        ;;
 
64
  *)
 
65
        N=/etc/init.d/$NAME
 
66
        # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
 
67
        echo "Usage: $N {start|stop|restart|force-reload}" >&2
 
68
        exit 1
 
69
        ;;
 
70
esac
 
71
 
 
72
exit 0