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