X-Git-Url: http://git.pld-linux.org/?a=blobdiff_plain;f=bacula-sd.init;h=52616b6d9bf22609da682b0e24ffd6de91f99543;hb=84742d8a460679d75a1a7a27f29b87f88e892a9f;hp=94a9d56e88c4ff2d4d51f6947910b9879e931970;hpb=aba6a208e61c2e2d86f13fd0965eb4f7be9ae2d6;p=packages%2Fbacula.git diff --git a/bacula-sd.init b/bacula-sd.init old mode 100644 new mode 100755 index 94a9d56..52616b6 --- a/bacula-sd.init +++ b/bacula-sd.init @@ -1,9 +1,9 @@ -#! /bin/sh +#!/bin/sh # # bacula This shell script takes care of starting and stopping # the bacula Storage daemon. # -# chkconfig: 2345 90 99 +# chkconfig: 2345 90 10 # description: It comes by night and sucks the vital essence from your computers. # @@ -12,41 +12,70 @@ BACULA_SD_USER="bacula" BACULA_SD_GROUP="bacula" +BACULA_SD_OPTIONS="" [ -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_already_running "Bacula Storage" + return + fi + msg_starting "Bacula Storage" - daemon /usr/sbin/bacula-sd -u "$BACULA_SD_USER" -g "$BACULA_SD_GROUP" $2 -c /etc/bacula/bacula-sd.conf + daemon /usr/sbin/bacula-sd -u "$BACULA_SD_USER" -g "$BACULA_SD_GROUP" -c /etc/bacula/bacula-sd.conf $BACULA_SD_OPTIONS RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/bacula-sd } stop() { + if [ ! -f /var/lock/subsys/bacula-sd ]; then + msg_not_running "Bacula Storage" + return + fi + + # Stop daemons. msg_stopping "Bacula Storage" killproc /usr/sbin/bacula-sd - RETVAL=$? - [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/bacula-sd + rm -f /var/lock/subsys/bacula-sd +} + +condrestart() { + if [ ! -f /var/lock/subsys/bacula-sd ]; then + msg_not_running "Bacula Storage" + RETVAL=$1 + return + fi + + stop + start } case "$1" in -start) + start) start ;; -stop) + stop) stop ;; -restart) + restart) stop sleep 5 start ;; -status) - status /usr/sbin/bacula-sd + try-restart) + condrestart 0 + ;; + force-reload) + condrestart 7 + ;; + status) + status bacula-sd RETVAL=$? ;; *) - echo "Usage: $0 {start|stop|restart|status}" - exit 1 + msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}" + exit 3 ;; esac exit $RETVAL