]> git.sur5r.net Git - bacula/bacula/blob - bacula/scripts/bacula.in
Backport from Bacula Enterprise
[bacula/bacula] / bacula / scripts / bacula.in
1 #! /bin/sh
2 #
3 #   Bacula(R) - The Network Backup Solution
4 #
5 #   Copyright (C) 2000-2015 Kern Sibbald
6 #   Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
7 #
8 #   The original author of Bacula is Kern Sibbald, with contributions
9 #   from many others, a complete list can be found in the file AUTHORS.
10 #
11 #   You may use this file and others of this release according to the
12 #   license defined in the LICENSE file, which includes the Affero General
13 #   Public License, v3.0 ("AGPLv3") and some additional permissions and
14 #   terms pursuant to its AGPLv3 Section 7.
15 #
16 #   This notice must be preserved when any source code is 
17 #   conveyed and/or propagated.
18 #
19 #   Bacula(R) is a registered trademark of Kern Sibbald.
20 #
21 # bacula       This shell script takes care of starting and stopping
22 #              the bacula daemons.
23 #
24 #   This is pretty much watered down version of the RedHat script
25 #   that works on Solaris as well as Linux, but it won't work everywhere.
26 #
27 # description: The Leading Open Source Backup Solution.
28 #
29
30 # All these are not *really* needed but it makes it
31 #  easier to "steal" this code for the development 
32 #  environment where they are different.
33 #  
34 SCRIPTDIR=@scriptdir@
35 #
36 # Disable Glibc malloc checks, it doesn't help and it keeps from getting
37 #   good dumps
38 MALLOC_CHECK_=0
39 export MALLOC_CHECK_
40
41 case "$1" in
42    start)
43       [ -x ${SCRIPTDIR}/bacula-ctl-sd ] && ${SCRIPTDIR}/bacula-ctl-sd $1 $2
44       [ -x ${SCRIPTDIR}/bacula-ctl-fd ] && ${SCRIPTDIR}/bacula-ctl-fd $1 $2
45       [ -x ${SCRIPTDIR}/bacula-ctl-dir ] && ${SCRIPTDIR}/bacula-ctl-dir $1 $2
46       ;;
47
48    stop)
49       # Stop the FD first so that SD will fail jobs and update catalog
50       [ -x ${SCRIPTDIR}/bacula-ctl-fd ] && ${SCRIPTDIR}/bacula-ctl-fd $1 $2
51       [ -x ${SCRIPTDIR}/bacula-ctl-sd ] && ${SCRIPTDIR}/bacula-ctl-sd $1 $2
52       [ -x ${SCRIPTDIR}/bacula-ctl-dir ] && ${SCRIPTDIR}/bacula-ctl-dir $1 $2
53       ;;
54
55    restart)
56       $0 stop
57       sleep 2
58       $0 start
59       ;;
60
61    status)
62       [ -x ${SCRIPTDIR}/bacula-ctl-sd ] && ${SCRIPTDIR}/bacula-ctl-sd status
63       [ -x ${SCRIPTDIR}/bacula-ctl-fd ] && ${SCRIPTDIR}/bacula-ctl-fd status
64       [ -x ${SCRIPTDIR}/bacula-ctl-dir ] && ${SCRIPTDIR}/bacula-ctl-dir status
65       ;;
66
67    *)
68       echo "Usage: $0 {start|stop|restart|status}"
69       exit 1
70       ;;
71 esac
72 exit 0