1#! /bin/sh
2#
3# Copyright (C) 2000-2015 Kern Sibbald
4# License: BSD 2-Clause; see file LICENSE-FOSS
5#
6# bacula       This shell script takes care of starting and stopping
7#	       the bacula Storage daemon.
8#
9# chkconfig: 2345 90 9
10# description: The Leading Open Source Backup Solution.
11#
12#  For Bacula release @VERSION@ (@DATE@) -- @DISTNAME@
13# Modified to work on SuSE 1/31/2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
14# Added rc.status functions 3/13/2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
15# Added LSB init info 10/14/2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
16#
17### BEGIN INIT INFO
18# Provides:			bacula-sd
19# Required-Start:		$local_fs $network
20# Required-Stop:		$local_fs $network
21# Default-Start:		3 5
22# Default-Stop: 	0 1 2 6
23# Short-Description:	bacula storage daemon
24# Description:			Bacula network backup system storage daemon
25### END INIT INFO
26
27# source process status functions
28# this gives us funtion rc_status -v to tell us if we succeed or fail
29. /etc/rc.status
30
31RETVAL=0
32case "$1" in
33    start)
34       echo -n "Starting the Bacula Storage daemon: "
35       /sbin/startproc @sbindir@/bacula-sd $2 -c @sysconfdir@/bacula-sd.conf
36       RETVAL=$?
37       rc_status -v
38       echo
39       [ $RETVAL -eq 0 ] && touch @subsysdir@/bacula-sd
40       ;;
41    stop)
42       echo -n "Stopping the Bacula Storage daemon: "
43       /sbin/killproc @sbindir@/bacula-sd
44       RETVAL=$?
45       rc_status -v
46       echo
47       [ $RETVAL -eq 0 ] && rm -f @subsysdir@/bacula-sd
48       ;;
49    restart)
50       $0 stop
51       sleep 5
52       $0 start
53       RETVAL=$?
54       ;;
55    status)
56       /sbin/checkproc @sbindir@/bacula-sd
57       RETVAL=$?
58       rc_status -v
59       ;;
60    *)
61       echo "Usage: $0 {start|stop|restart|status}"
62       exit 1
63       ;;
64esac
65exit $RETVAL
66