]> git.sur5r.net Git - bacula/bacula/blob - bacula/platforms/solaris/bacula-sd.in
Cleanup Solaris init scripts and made them zone aware.
[bacula/bacula] / bacula / platforms / solaris / bacula-sd.in
1 #!/bin/sh
2 #
3 # bacula       This shell script takes care of starting and stopping
4 #              the bacula Storage daemon.
5 #
6 # description: The Leading Open Source Backup Solution.
7 #
8 # For Bacula release @VERSION@ (@DATE@) -- @DISTNAME@
9 #
10
11 SD_USER=@sd_user@
12 SD_GROUP=@sd_group@
13 SD_OPTIONS=''
14
15 case "$1" in
16     start)
17        if [ ! -z "${DIR_USER}" ]; then
18           [ -z "${DIR_OPTIONS}" ] && DIR_OPTIONS="-u ${DIR_USER}" || \
19                                      DIR_OPTIONS="${DIR_OPTIONS} -u ${DIR_USER}"
20        fi
21        if [ ! -z "${DIR_GROUP}" ]; then
22           [ -z "${DIR_OPTIONS}" ] && DIR_OPTIONS="-g ${DIR_GROUP}" || \
23                                      DIR_OPTIONS="${DIR_OPTIONS} -g ${DIR_GROUP}"
24        fi
25
26        echo "Starting the Bacula Storage daemon: "
27        @sbindir@/bacula-sd $2 ${SD_OPTIONS} -c @sysconfdir@/bacula-sd.conf
28        ;;
29     stop)
30        echo "Stopping the Bacula Storage daemon: "
31        if [ -x /usr/bin/zonename ]; then
32           case `/usr/bin/zonename` in
33              global)
34                 pkill -z global -x bacula-sd
35                 ;;
36              *)
37                 pkill -x bacula-sd
38                 ;;
39           esac
40        else
41           pkill -x bacula-sd
42        fi
43        ;;
44     restart)
45        $0 stop
46        sleep 5
47        $0 start
48        ;;
49     *)
50        echo "Usage: $0 {start|stop|restart}"
51        exit 1
52        ;;
53 esac
54 exit 0