]> git.sur5r.net Git - bacula/bacula/blob - bacula/platforms/debian/bacula-director
Added delete and purge options in medialist. Shorten headings to get more to
[bacula/bacula] / bacula / platforms / debian / bacula-director
1 #! /bin/sh
2 # bacula-director     SysV init script for Bacula-FD.
3 #
4 #       Written by Miquel van Smoorenburg <miquels@cistron.nl>.
5 #       Modified for Debian GNU/Linux by Ian Murdock <imurdock@gnu.ai.mit.edu>.
6 #       Customized for Bacula by Jose Luis Tallon <jltallon@adv-solutions.net>
7 #    Modified RJM 2-12-03 to fix errors with pidfile name
8 #
9 PATH=/sbin:/bin:/usr/sbin:/usr/bin
10 DAEMON=/usr/sbin/bacula-dir
11 NAME="bacula-dir"
12 PORT=9101
13 DESC="Bacula Director"
14 ARGS="-c /etc/bacula/bacula-dir.conf -u bacula -g bacula"
15
16 test -f $DAEMON || exit 0
17
18 set -e
19
20 if [ -n "`getent services bacula-dir`" ]; then
21         PORT=`getent services bacula-dir | awk '{ gsub("/tcp","",$2); print $2; }'`
22 fi
23  
24 PIDFILE=/var/run/bacula/$NAME.$PORT.pid
25
26 case "$1" in
27   start)
28         if [ -f /etc/bacula/do_not_run ]; then
29                 echo "Not starting $DESC: disabled via /etc/bacula/do_not_run"
30                 exit 0
31         fi
32
33         echo -n "Starting $DESC: "
34         start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- $ARGS
35         echo "$NAME."
36         ;;
37
38   stop)
39         echo -n "Stopping $DESC: "
40         start-stop-daemon --oknodo --stop --quiet --pidfile $PIDFILE --exec $DAEMON
41         echo "$NAME."
42         ;;
43
44   restart|force-reload)
45         echo -n "Restarting $DESC: "
46         start-stop-daemon --stop --quiet --pidfile $PIDFILE --exec $DAEMON
47         sleep 1
48         start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- $ARGS
49         echo "$NAME."
50         ;;
51   *)
52         N=/etc/init.d/$NAME
53         # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
54         echo "Usage: $N {start|stop|restart|force-reload}" >&2
55         exit 1
56         ;;
57 esac
58
59 exit 0