]> git.sur5r.net Git - bacula/bacula/blob - bacula/platforms/gentoo/bacula-init.in
1.36.2 release
[bacula/bacula] / bacula / platforms / gentoo / bacula-init.in
1 #!/sbin/runscript
2 # Copyright 1999-2004 Gentoo Foundation
3 # Distributed under the terms of the GNU General Public License v2
4 # Modified for user/group information
5 # 24 Oct 2004 D. Scott Barninger <barninger at fairfieldcomputers dot com
6
7 depend() {
8         need net
9         use @DB_NAME@
10 }
11
12 opts="test"
13
14 DIR_USER=@dir_user@
15 DIR_GROUP=@dir_group@
16 SD_USER=@sd_user@
17 SD_GROUP=@sd_group@
18 FD_USER=@fd_user@
19 FD_GROUP=@fd_group@
20
21 # A client would only need to run the file daemon, so if thats the
22 # case for this machine just comment the other two out below here...
23 start() {
24         ebegin "Starting bacula storage daemon"
25         OPTIONS=''
26         if [ "${SD_USER}" != '' ]; then
27                 OPTIONS="${OPTIONS} -u ${SD_USER}"
28         fi
29                                                                                    
30         if [ "${SD_GROUP}" != '' ]; then
31                 OPTIONS="${OPTIONS} -g ${SD_GROUP}"
32         fi
33         start-stop-daemon --start --quiet --exec @sbindir@/bacula-sd \
34                 -- ${OPTIONS} -c @sysconfdir@/bacula-sd.conf
35         result=$?
36
37         ebegin "Starting bacula file daemon"
38         OPTIONS=''
39         if [ "${FD_USER}" != '' ]; then
40                 OPTIONS="${OPTIONS} -u ${FD_USER}"
41         fi
42                                                                                    
43         if [ "${FD_GROUP}" != '' ]; then
44                 OPTIONS="${OPTIONS} -g ${FD_GROUP}"
45         fi
46         start-stop-daemon --start --quiet --exec @sbindir@/bacula-fd \
47                 -- ${OPTIONS} -c @sysconfdir@/bacula-fd.conf
48         result=$(( $result + $? ))
49         sleep 2
50
51         ebegin "Starting bacula director"
52         OPTIONS=''
53         if [ "${DIR_USER}" != '' ]; then
54                 OPTIONS="${OPTIONS} -u ${DIR_USER}"
55         fi
56                                                                                    
57         if [ "${DIR_GROUP}" != '' ]; then
58                 OPTIONS="${OPTIONS} -g ${DIR_GROUP}"
59         fi
60         start-stop-daemon --start --quiet --exec @sbindir@/bacula-dir \
61                 -- ${OPTIONS} -c @sysconfdir@/bacula-dir.conf
62         result=$(( $result + $? ))
63
64         eend $result
65 }
66
67 # The default port numbers appear in the pidfile paths below.
68 # Might wanna programmatically grab them from the config files
69 # or something...
70 stop() {
71         ebegin "Stopping bacula file daemon"
72         start-stop-daemon --stop --quiet --pidfile /var/run/bacula-fd.9102.pid
73         result=$?
74         ebegin "Stopping bacula storage daemon"
75         start-stop-daemon --stop --quiet --pidfile /var/run/bacula-sd.9103.pid
76         result=$(( $result + $? ))
77         ebegin "Stopping bacula director"
78         start-stop-daemon --stop --quiet --pidfile /var/run/bacula-dir.9101.pid
79         result=$(( $result + $? ))
80         eend $result
81 }
82
83 test() {
84         ebegin "Testing bacula storage daemon configuration"
85         @sbindir@/bacula-sd -t -c @sysconfdir@/bacula-sd.conf
86         result=$?
87         ebegin "Testing bacula file daemon configuration"
88         @sbindir@/bacula-fd -t -c @sysconfdir@/bacula-fd.conf
89         result=$(( $result + $? ))
90         ebegin "Testing bacula director configuration"
91         @sbindir@/bacula-dir -t -c @sysconfdir@/bacula-dir.conf
92         result=$(( $result + $? ))
93         eend $result
94 }