]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/platforms/solaris/bacula-sd.in
Cleanup Solaris init scripts and made them zone aware.
[bacula/bacula] / bacula / platforms / solaris / bacula-sd.in
index 79e1a91ee6853da80c81744dc11fe4b77027bc6a..752579e1cb7e77ed7b867b7fb79a357fad6e0a88 100755 (executable)
@@ -1,28 +1,45 @@
-#! /bin/sh
+#!/bin/sh
 #
 # bacula       This shell script takes care of starting and stopping
 #             the bacula Storage daemon.
 #
-# chkconfig: 2345 20 99
-# description: It comes by night and sucks the vital essence from your computers.
+# description: The Leading Open Source Backup Solution.
 #
-#  For Bacula release @VERSION@ (@DATE@) -- @DISTNAME@
+# For Bacula release @VERSION@ (@DATE@) -- @DISTNAME@
 #
 
+SD_USER=@sd_user@
+SD_GROUP=@sd_group@
+SD_OPTIONS=''
+
 case "$1" in
     start)
+       if [ ! -z "${DIR_USER}" ]; then
+          [ -z "${DIR_OPTIONS}" ] && DIR_OPTIONS="-u ${DIR_USER}" || \
+                                     DIR_OPTIONS="${DIR_OPTIONS} -u ${DIR_USER}"
+       fi
+       if [ ! -z "${DIR_GROUP}" ]; then
+          [ -z "${DIR_OPTIONS}" ] && DIR_OPTIONS="-g ${DIR_GROUP}" || \
+                                     DIR_OPTIONS="${DIR_OPTIONS} -g ${DIR_GROUP}"
+       fi
+
        echo "Starting the Bacula Storage daemon: "
-       @sbindir@/bacula-sd $2 -c @sysconfdir@/bacula-sd.conf
-       RETVAL=$?
-       echo
-       [ $RETVAL -eq 0 ] && touch @subsysdir@/bacula-sd
+       @sbindir@/bacula-sd $2 ${SD_OPTIONS} -c @sysconfdir@/bacula-sd.conf
        ;;
     stop)
        echo "Stopping the Bacula Storage daemon: "
-#      killproc @sbindir@/bacula-sd
-       RETVAL=$?
-       echo
-       [ $RETVAL -eq 0 ] && rm -f @subsysdir@/bacula-sd
+       if [ -x /usr/bin/zonename ]; then
+          case `/usr/bin/zonename` in
+             global)
+                pkill -z global -x bacula-sd
+                ;;
+             *)
+                pkill -x bacula-sd
+                ;;
+          esac
+       else
+          pkill -x bacula-sd
+       fi
        ;;
     restart)
        $0 stop