~upstart-devel/upstart/upstart-jobs

« back to all changes in this revision

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

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