X-Git-Url: https://git.pld-linux.org/?a=blobdiff_plain;f=bacula-sd.init;h=67b41ee43a147182ed23b049bba1b929caad4922;hb=819cd4b04fdbd503cd9c62f344a907109932aae0;hp=a55925fd794e4ddd5a5a1b903315284806d07831;hpb=7193cf5741d764649ced8e0c5206f232e0a33d06;p=packages%2Fbacula.git diff --git a/bacula-sd.init b/bacula-sd.init index a55925f..67b41ee 100644 --- a/bacula-sd.init +++ b/bacula-sd.init @@ -1,7 +1,7 @@ #! /bin/sh # -# bacula This shell script takes care of starting and stopping -# the bacula Storage daemon. +# bacula This shell script takes care of starting and stopping +# the bacula Storage daemon. # # chkconfig: 2345 90 99 # description: It comes by night and sucks the vital essence from your computers. @@ -14,32 +14,49 @@ BACULA_SD_USER="bacula" BACULA_SD_GROUP="bacula" [ -f /etc/sysconfig/bacula-sd ] && . /etc/sysconfig/bacula-sd +start() { + # Check if the service is already running? + if [ ! -f /var/lock/subsys/bacula-sd ]; then + msg_starting "Bacula Storage" + daemon /usr/sbin/bacula-sd -u "$BACULA_SD_USER" -g "$BACULA_SD_GROUP" $2 -c /etc/bacula/bacula-sd.conf + RETVAL=$? + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/bacula-sd + else + msg_already_running "Bacula Storage" + fi +} + +stop() { + if [ -f /var/lock/subsys/bacula-sd ]; then + # Stop daemons. + msg_stopping "Bacula Storage" + killproc /usr/sbin/bacula-sd + RETVAL=$? + rm -f /var/lock/subsys/bacula-sd + else + msg_not_running "Bacula Storage" + fi +} case "$1" in - start) - msg_starting "Bacula Storage" - daemon /usr/sbin/bacula-sd -u "$BACULA_SD_USER" -g "$BACULA_SD_GROUP" $2 -c /etc/bacula/bacula-sd.conf - RETVAL=$? - [ $RETVAL -eq 0 ] && touch /var/lock/subsys/bacula-sd - ;; - stop) - msg_stopping "Bacula Storage" - killproc /usr/sbin/bacula-sd - RETVAL=$? - [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/bacula-sd - ;; - restart) - $0 stop && sleep 5 - $0 start - RETVAL=$? - ;; - status) - status /usr/sbin/bacula-sd - RETVAL=$? - ;; - *) - echo "Usage: $0 {start|stop|restart|status}" - exit 1 - ;; +start) + start + ;; +stop) + stop + ;; +restart) + stop + sleep 5 + start + ;; +status) + status /usr/sbin/bacula-sd + RETVAL=$? + ;; +*) + msg_usage "$0 {start|stop|restart|status}" + exit 3 + ;; esac exit $RETVAL