]> git.pld-linux.org Git - packages/bacula.git/blobdiff - bacula-sd.init
x32.patch updated
[packages/bacula.git] / bacula-sd.init
old mode 100644 (file)
new mode 100755 (executable)
index f3ffab2..52616b6
@@ -1,40 +1,81 @@
-#! /bin/sh
+#!/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
+# chkconfig: 2345 90 10
 # description: It comes by night and sucks the vital essence from your computers.
 #
 
 # Source function library
 . /etc/rc.d/init.d/functions
 
+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" -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
+       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)
-       msg_starting "Bacula Storage daemon"
-       daemon /usr/sbin/bacula-sd $2 -c /etc/bacula/bacula-sd.conf
-       RETVAL=$?
-       [ $RETVAL -eq 0 ] && touch @subsysdir@/bacula-sd
-       ;;
-    stop)
-       msg_stopping "Bacula Storage daemon"
-       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
+       ;;
+  try-restart)
+       condrestart 0
+       ;;
+  force-reload)
+       condrestart 7
+       ;;
+  status)
+       status bacula-sd
+       RETVAL=$?
+       ;;
+*)
+       msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
+       exit 3
+       ;;
 esac
 exit $RETVAL
This page took 0.109509 seconds and 4 git commands to generate.