~upstart-devel/upstart/upstart-jobs

« back to all changes in this revision

Viewing changes to utopic/etc/init.d/bindgraph

  • 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
 
#
3
 
### BEGIN INIT INFO
4
 
# Provides:          bindgraph
5
 
# Required-Start:    $syslog $network $remote_fs
6
 
# Required-Stop:     $syslog $remote_fs
7
 
# Should-Start:      $local_fs $named
8
 
# Should-Stop:       $local_fs
9
 
# Default-Start:     2 3 4 5
10
 
# Default-Stop:      0 1 6
11
 
# Short-Description: BIND graph
12
 
# Description:       Create graphs from DNS activity
13
 
### END INIT INFO
14
 
#
15
 
# initscript for bindgraph
16
 
# (C) 2006 Jose Luis Tallon <jltallon@adv-solutions.net>
17
 
# based upon <skeleton>, code by Ian Murdock and others
18
 
 
19
 
CONFIG=/etc/default/bindgraph
20
 
DNS_LOG=/var/log/bind9-query.log
21
 
 
22
 
NAME=bindgraph
23
 
DESC="DNS Statistics"
24
 
DAEMON=/usr/sbin/bindgraph.pl
25
 
 
26
 
PIDFILE=/var/run/servergraph/bindgraph.pid
27
 
CACHEDIR=/var/cache/bindgraph
28
 
RRD_DIR=/var/lib/bindgraph
29
 
RRD_NAME=bindgraph
30
 
 
31
 
test -x $DAEMON || exit 0
32
 
 
33
 
if [ -f $CONFIG ]; then
34
 
        . $CONFIG
35
 
fi
36
 
 
37
 
# Just to be sure it is there...
38
 
pid_dir=`dirname $PIDFILE`
39
 
test -d $pid_dir || mkdir -p $pid_dir
40
 
chown daemon:root $pid_dir
41
 
 
42
 
 
43
 
. /lib/lsb/init-functions
44
 
 
45
 
if [ -n "$LOG_FORMAT" ]; then
46
 
        FORMAT="--format=${LOG_FORMAT}"
47
 
fi
48
 
 
49
 
case "$1" in
50
 
  start)
51
 
        log_daemon_msg "Starting $DESC" "$DAEMON"
52
 
        if start-stop-daemon --start --quiet --exec $DAEMON -N 15 -c daemon:adm -- \
53
 
                -l $DNS_LOG $FORMAT -d --daemon_rrd=$RRD_DIR --rrd_name=$RRD_NAME $ARGS ;
54
 
        then
55
 
                log_end_msg 0
56
 
        else
57
 
                log_end_msg $?
58
 
        fi
59
 
  ;;
60
 
 
61
 
  stop)
62
 
        log_daemon_msg "Stopping $DESC: " "$DAEMON"
63
 
        start-stop-daemon --stop --oknodo --pidfile $PIDFILE -c daemon:adm ;
64
 
        st=$?
65
 
        rm -f $PIDFILE
66
 
        log_end_msg $st
67
 
  ;;
68
 
 
69
 
  restart|force-reload)
70
 
        $0 stop
71
 
        sleep 1
72
 
        $0 start
73
 
  ;;
74
 
 
75
 
  status)
76
 
        if pidofproc -p $PIDFILE $DAEMON ; then
77
 
                log_success_msg "$DAEMON is running"
78
 
                exit 0
79
 
        else
80
 
                log_success_msg "$DAEMON is not running"
81
 
                exit 3
82
 
        fi                                                                      
83
 
  ;;
84
 
 
85
 
  *)
86
 
    log_success_msg "Usage: $0 start|stop|restart|force-reload"
87
 
    exit 0
88
 
    ;;
89
 
esac
90
 
 
91
 
exit 0