X-Git-Url: http://git.pld-linux.org/?a=blobdiff_plain;f=bacula-fd.init;h=7848300c6c12428b4c5c79857209bc306d7f6f3a;hb=84742d8a460679d75a1a7a27f29b87f88e892a9f;hp=7d3e7c0980286b7c178920207362660dec826473;hpb=cdaeb249961a7b5a8caa6b9098e06206e5a848b0;p=packages%2Fbacula.git diff --git a/bacula-fd.init b/bacula-fd.init old mode 100644 new mode 100755 index 7d3e7c0..7848300 --- a/bacula-fd.init +++ b/bacula-fd.init @@ -1,43 +1,81 @@ -#! /bin/sh +#!/bin/sh # -# bacula This shell script takes care of starting and stopping -# the bacula File daemon. +# bacula This shell script takes care of starting and stopping +# the bacula File daemon. # -# chkconfig: 2345 91 99 +# chkconfig: 2345 91 09 # description: It comes by night and sucks the vital essence from your computers. # -# For Bacula release @VERSION@ (@DATE@) -- @DISTNAME@ -# # Source function library . /etc/rc.d/init.d/functions +BACULA_FD_USER="bacula" +BACULA_FD_GROUP="bacula" +BACULA_FD_OPTIONS="" +[ -f /etc/sysconfig/bacula-fd ] && . /etc/sysconfig/bacula-fd + +start() { + # Check if the service is already running? + if [ -f /var/lock/subsys/bacula-fd ]; then + msg_already_running "Bacula File" + return + fi + + msg_starting "Bacula File" + daemon /usr/sbin/bacula-fd -u "$BACULA_FD_USER" -g "$BACULA_FD_GROUP" -c /etc/bacula/bacula-fd.conf $BACULA_FD_OPTIONS + RETVAL=$? + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/bacula-fd +} + +stop() { + if [ ! -f /var/lock/subsys/bacula-fd ]; then + msg_not_running "Bacula File" + return + fi + + # Stop daemons. + msg_stopping "Bacula File" + killproc /usr/sbin/bacula-fd + rm -f /var/lock/subsys/bacula-fd +} + +condrestart() { + if [ ! -f /var/lock/subsys/bacula-fd ]; then + msg_not_running "Bacula File" + RETVAL=$1 + return + fi + + stop + start +} + case "$1" in - start) - echo -n "Starting the Bacula File daemon: " - daemon @sbindir@/bacula-fd $2 -c @sysconfdir@/bacula-fd.conf - RETVAL=$? - echo - [ $RETVAL -eq 0 ] && touch @subsysdir@/bacula-fd - ;; - stop) - echo -n "Stopping the Bacula File daemon: " - killproc @sbindir@/bacula-fd - RETVAL=$? - echo - [ $RETVAL -eq 0 ] && rm -f @subsysdir@/bacula-fd - ;; - restart) - $0 stop - sleep 5 - $0 start - ;; - status) - status @sbindir@/bacula-fd - ;; - *) - echo "Usage: $0 {start|stop|restart|status}" - exit 1 - ;; + start) + start + ;; + stop) + stop + ;; + restart) + stop + sleep 5 + start + ;; + try-restart) + condrestart 0 + ;; + force-reload) + condrestart 7 + ;; + status) + status bacula-fd + RETVAL=$? + ;; +*) + msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}" + exit 3 + ;; esac -exit 0 +exit $RETVAL