/[smecontribs]/rpms/bacula/contribs8/bacula-sd.init
ViewVC logotype

Annotation of /rpms/bacula/contribs8/bacula-sd.init

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (hide annotations) (download)
Fri Dec 3 17:41:52 2010 UTC (13 years, 11 months ago) by slords
Branch: MAIN
CVS Tags: bacula-5_0_3-1_el5_sme, HEAD
Initial import

1 slords 1.1 #!/bin/bash
2     #
3     # bacula-sd This shell script takes care of starting and stopping
4     # the Bacula storage daemon (SD).
5     #
6     # chkconfig: - 90 09
7     # description: Bacula is a network client/server based backup program.
8     # processname: bacula-sd
9     # config: /etc/bacula/bacula-sd.conf
10     # pidfile: /var/run/bacula-sd.pid
11    
12     # Source function library.
13     . /etc/rc.d/init.d/functions
14    
15     # Source networking configuration.
16     . /etc/sysconfig/network
17    
18     # Check that networking is up.
19     [ ${NETWORKING} = "no" ] && exit 1
20    
21     # Defines
22     DESC="Bacula Storage services"
23     PROG="bacula-sd"
24     EXEC="/usr/sbin/${PROG}"
25     LOCK="/var/lock/subsys/${PROG}"
26     PIDF="/var/run/${PROG}.pid"
27     CONF="/etc/bacula/${PROG}.conf"
28    
29     # Include config
30     if [ -s /etc/sysconfig/${PROG} ]; then
31     . /etc/sysconfig/${PROG}
32     fi
33    
34     # Check for binaries and configs
35     [ -x ${EXEC} ] || exit 5
36     [ -f ${CONF} ] || exit 6
37    
38     # Select correct pthreads
39     if [ -d "/lib/tls" -o -d "/lib64/tls" -a `uname -r | cut -c1-3` = "2.4" ]; then
40     export LD_ASSUME_KERNEL=2.4.19
41     fi
42    
43    
44     checkcfg() {
45     CONF_OK=0
46     if ${EXEC} ${SD_OPTIONS} ${OPTIONS} -t >/dev/null 2>&1; then
47     CONF_OK=1
48     else
49     RETVAL=$?
50     fi
51    
52     if [ ${CONF_OK} -ne 1 ]; then
53     ERR=`${EXEC} ${SD_OPTIONS} ${OPTIONS} -t 2>&1 | sed s/\n/\\n/g`
54    
55     if [ `tty` != "/dev/console" ]; then
56     echo -e "\n${ERR}"
57     echo -n $"Error in configuration file ${CONF}: "
58     fi
59    
60     failure $"Error in configuration file ${CONF}: ${ERR}"
61     echo
62     exit ${RETVAL}
63     fi
64     }
65    
66     start() {
67     # Start daemons.
68     echo -n $"Starting ${DESC}: "
69     checkcfg
70    
71     daemon ${EXEC} ${SD_OPTIONS} ${OPTIONS}
72     RETVAL=$?
73    
74     [ ${RETVAL} -eq 0 ] && touch ${LOCK}
75     echo
76     return ${RETVAL}
77     }
78    
79     stop() {
80     # Stop daemons.
81     echo -n $"Shutting down ${DESC}: "
82     killproc ${PROG}
83     RETVAL=$?
84    
85     [ ${RETVAL} -eq 0 ] && rm -f ${LOCK}
86     echo
87     return ${RETVAL}
88     }
89    
90     restart() {
91     stop
92     sleep 2
93     start
94     }
95    
96     force_reload() {
97     restart
98     }
99    
100     rh_status() {
101     status ${PROG}
102     }
103    
104     rh_status_q() {
105     rh_status >/dev/null 2>&1
106     }
107    
108    
109     # See how we were called.
110     case "${1}" in
111     start)
112     rh_status_q && exit 0
113     ${1}
114     ;;
115     stop)
116     rh_status_q || exit 0
117     ${1}
118     ;;
119     restart)
120     ${1}
121     ;;
122     force-reload)
123     force_reload
124     ;;
125     status)
126     rh_status
127     ;;
128     condrestart|try-restart)
129     rh_status_q || exit 0
130     restart
131     ;;
132     *)
133     echo $"Usage: ${PROG} {start|stop|status|restart|try-restart|force-reload}"
134     exit 2
135     esac
136     exit ${?}

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed