]> git.sur5r.net Git - bacula/bacula/blob - bacula/scripts/breload
Tweak delta-test to use ofname instead of fixed name
[bacula/bacula] / bacula / scripts / breload
1 #! /bin/sh
2 #
3 # breload This shell script takes care of reloading the director after
4 #         a backup of the configuration and a bacula-dir -t test
5 #
6 #
7
8 BACDIRBIN=/sbin
9 BACDIRCFG=/etc/bacula
10 BACWORKDIR=/var/bacula/working
11 BACBKPDIR=$BACWORKDIR/bkp
12 Bacula="Bacula"
13 DIR_USER=
14 RET=0
15
16 if [ -x ${BACDIRBIN}/bacula-dir -a -r ${BACDIRCFG}/bacula-dir.conf ]; then
17   echo "Testing the $Bacula Director daemon configuration"
18
19   if [ $(whoami) != "$DIR_USER" ]; then
20       USER_OPT="-u $DIR_USER"
21   fi
22
23   ${BACDIRBIN}/bacula-dir -t $USER_OPT -c ${BACDIRCFG}/bacula-dir.conf
24
25   RET=$?
26   if [ $RET = 0 ]; then
27       if [ ! -d $BACBKPDIR ]; then
28          echo "Creating Backup configuration directory"
29          mkdir -p $BACBKPDIR 
30          chmod 700 $BACBKPDIR
31          chown $DIR_USER $BACBKPDIR
32       fi
33       if [ -d $BACBKPDIR ]; then
34         echo "Backup configuration"
35         tar cfz $BACBKPDIR/bacula-dir-conf.$(date +%s).tgz $BACDIRCFG/*conf
36       fi
37       echo reload | ${BACDIRBIN}/bconsole >/dev/null
38       echo "Reloading configuration"
39   else
40       echo "Can't reload configuration, please correct errors first"
41   fi
42 fi 
43 exit $RET