~ubuntu-branches/ubuntu/maverick/powernap/maverick

« back to all changes in this revision

Viewing changes to debian/init

  • Committer: Bazaar Package Importer
  • Author(s): Dustin Kirkland
  • Date: 2009-07-10 17:37:54 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20090710173754-31ix19h4qbvl3bri
Tags: 1.5-0ubuntu1
* powerwake: handle more gracefully the lack of an /etc/ethers file
* powernapd: fix timestamp

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#! /bin/sh -e
2
 
### BEGIN INIT INFO
3
 
# Provides:          powernap
4
 
# Required-Start:    $all
5
 
# Required-Stop:
6
 
# Default-Start:     2 3 4 5
7
 
# Default-Stop:      1
8
 
# Short-Description: execute action when processes absent for some time
9
 
### END INIT INFO
10
 
#
11
 
# Author:       Dustin Kirkland <kirkland@canonical.com>
12
 
 
13
 
 
14
 
PKG=powernap
15
 
DAEMON=/usr/sbin/$PKG
16
 
PIDFILE=/var/run/$PKG.pid
17
 
 
18
 
test -x $DAEMON || exit 0
19
 
 
20
 
. /lib/lsb/init-functions
21
 
 
22
 
case "$1" in
23
 
        start)
24
 
                log_daemon_msg "Starting $PKG"
25
 
                start_daemon $DAEMON
26
 
                log_end_msg $?
27
 
        ;;
28
 
        stop)
29
 
                log_daemon_msg "Stopping $PKG"
30
 
                killproc -p $PIDFILE $DAEMON
31
 
                log_end_msg $?
32
 
        ;;
33
 
        force-reload|restart)
34
 
                $0 stop
35
 
                $0 start
36
 
        ;;
37
 
        now)
38
 
                if status_of_proc -p $PIDFILE $DAEMON $PKG; then
39
 
                        log_begin_msg "Sending $PKG the 'now' signal"
40
 
                        kill -USR1 $(cat $PIDFILE)
41
 
                        log_end_msg $?
42
 
                fi
43
 
        ;;
44
 
        status)
45
 
                status_of_proc -p $PIDFILE $DAEMON $PKG && exit 0 || exit $?
46
 
        ;;
47
 
        *)
48
 
                log_warning_msg "Usage: /etc/init.d/$PKG {start|stop|restart|force-reload|now|status}"
49
 
                exit 1
50
 
        ;;
51
 
esac
52
 
 
53
 
exit 0