~upstart-devel/upstart/upstart-jobs

« back to all changes in this revision

Viewing changes to utopic/etc/init.d/bacula-sd

  • 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:          bacula-sd
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 Bacula Storage Daemon at boot time
9
 
# Description:       bacula-sd is daemon that perform the storage and recovery
10
 
#                    of the file attributes and data to the physical backup
11
 
#                    media or volumes. In other words, the Storage daemon is
12
 
#                    responsible for reading and writing your tapes (or other
13
 
#                    storage media, e.g. files).
14
 
### END INIT INFO
15
 
#
16
 
# bacula-fd     SysV init script for Bacula-FD.
17
 
#
18
 
#       Written by Miquel van Smoorenburg <miquels@cistron.nl>.
19
 
#       Modified for Debian GNU/Linux by Ian Murdock <imurdock@gnu.ai.mit.edu>
20
 
#       Customized for Bacula by Jose Luis Tallon <jltallon@adv-solutions.net>
21
 
#
22
 
 
23
 
set -e
24
 
 
25
 
PATH=/sbin:/bin:/usr/sbin:/usr/bin
26
 
DAEMON=/usr/sbin/bacula-sd
27
 
NAME="bacula-sd"
28
 
PORT=9103
29
 
DESC="Bacula Storage daemon"
30
 
 
31
 
test -x $DAEMON || exit 0
32
 
 
33
 
if [ -n "`getent services bacula-sd`" ]; then
34
 
        PORT=`getent services bacula-sd | awk '{ gsub("/tcp","",$2); print $2; }'`
35
 
fi
36
 
 
37
 
. /lib/lsb/init-functions
38
 
. /usr/share/bacula-common/common-functions.init
39
 
if [ -r /etc/default/$NAME ]; then
40
 
        . /etc/default/$NAME
41
 
fi
42
 
 
43
 
CONFIG="${CONFIG:-/etc/bacula/$NAME.conf}"
44
 
 
45
 
create_var_run_dir
46
 
 
47
 
PIDFILE=/var/run/bacula/$NAME.$PORT.pid
48
 
 
49
 
do_start()
50
 
{
51
 
        start-stop-daemon --start --quiet --pidfile $PIDFILE \
52
 
        --oknodo --exec $DAEMON -- -c $CONFIG $ARGS
53
 
}
54
 
 
55
 
do_stop()
56
 
{
57
 
        start-stop-daemon --oknodo --stop --quiet --pidfile $PIDFILE \
58
 
        --retry TERM/30/KILL/5 --exec $DAEMON -- -c $CONFIG $ARGS
59
 
}
60
 
 
61
 
case "$1" in
62
 
  start)
63
 
        if [ "$ENABLED" = "no" ]; then
64
 
                log_failure_msg "Not starting $DESC: disabled via /etc/default/$NAME"
65
 
                exit 0
66
 
        fi
67
 
 
68
 
        log_daemon_msg "Starting $DESC..." "$NAME"
69
 
        if do_start ; then
70
 
                log_end_msg 0
71
 
        else
72
 
                log_end_msg 1
73
 
        fi
74
 
        ;;
75
 
  stop)
76
 
        log_daemon_msg "Stopping $DESC..." "$NAME"
77
 
        if do_stop ; then
78
 
                log_end_msg 0
79
 
        else
80
 
                log_end_msg 1
81
 
        fi
82
 
        ;;
83
 
 
84
 
  restart|force-reload)
85
 
        $0 stop
86
 
        sleep 1
87
 
        $0 start
88
 
        ;;
89
 
  status)
90
 
        status_of_proc -p $PIDFILE $DAEMON $NAME
91
 
        ;;
92
 
  *)
93
 
        N=/etc/init.d/$NAME
94
 
        echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
95
 
        exit 1
96
 
        ;;
97
 
esac
98
 
 
99
 
exit 0