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