]> git.pld-linux.org Git - packages/bacula.git/blobdiff - bacula-dir.init
- the bat.conf-fixing trigger moved to the common-package. Insecure files may
[packages/bacula.git] / bacula-dir.init
index 399eda2a230a3c634af1bf487a115bec3a9bd736..cc85b3da9fd2c9c7c8fd0eff2dc754260f3015eb 100644 (file)
 . /etc/rc.d/init.d/functions
 
 start() {
-       msg_starting "Bacula Director"
-       daemon /usr/sbin/bacula-dir -u bacula -g bacula $2 -c /etc/bacula/bacula-dir.conf
-       RETVAL=$?
-       [ $RETVAL -eq 0 ] && touch /var/lock/subsys/bacula-dir
+       # Check if the service is already running?
+       if [ ! -f /var/lock/subsys/bacula-dir ]; then
+               msg_starting "Bacula Director"
+               daemon /usr/sbin/bacula-dir -u bacula -g bacula $2 -c /etc/bacula/bacula-dir.conf
+               RETVAL=$?
+               [ $RETVAL -eq 0 ] && touch /var/lock/subsys/bacula-dir
+       else
+               msg_already_running "Bacula Director"
+       fi
 }
 
 stop() {
-       msg_stopping "Bacula Director"
-       killproc /usr/sbin/bacula-dir
-       RETVAL=$?
-       [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/bacula-dir
+       if [ -f /var/lock/subsys/bacula-dir ]; then
+               # Stop daemons.
+               msg_stopping "Bacula Director"
+               killproc /usr/sbin/bacula-dir
+               RETVAL=$?
+               rm -f /var/lock/subsys/bacula-dir
+       else
+               msg_not_running "Bacula Director"
+       fi
 }
 
 RETVAL=0
@@ -42,8 +52,8 @@ status)
        RETVAL=$?
        ;;
 *)
-       echo "Usage: $0 {start|stop|restart|status}"
-       exit 1
+       msg_usage "$0 {start|stop|restart|status}"
+       exit 3
        ;;
 esac
 exit $RETVAL
This page took 0.036154 seconds and 4 git commands to generate.