87 lines
1.6 KiB
Bash
87 lines
1.6 KiB
Bash
#!/bin/bash
|
|
#
|
|
# bacula-sd This shell script takes care of starting and stopping
|
|
# the bacula-sd daemon, the storage daemon responsible
|
|
# for accessing the backup storage device.
|
|
#
|
|
# chkconfig: - 80 20
|
|
# description: Bacula-sd is the storage-server, which is the program \
|
|
# that accesses the storage device.
|
|
# processname: bacula-sd
|
|
# config: /etc/bacula/bacula-sd.conf
|
|
# pidfile: /var/run/bacula-dir.9103.pid
|
|
|
|
# Source function library.
|
|
. /etc/init.d/functions
|
|
|
|
# Source configuration.
|
|
if [ -f /etc/sysconfig/bacula-sd ] ; then
|
|
. /etc/sysconfig/bacula-sd
|
|
fi
|
|
|
|
RETVAL=0
|
|
prog="bacula-sd"
|
|
CONFIG="/etc/bacula/bacula-sd.conf"
|
|
OPTS="-c $CONFIG"
|
|
|
|
if [ "$SD_USER" != '' ]; then
|
|
OPTS="$OPTS -u $SD_USER"
|
|
fi
|
|
|
|
if [ "$SD_GROUP" != '' ]; then
|
|
OPTS="$OPTS -g $SD_GROUP"
|
|
fi
|
|
|
|
start() {
|
|
[ "$EUID" != "0" ] && exit 4
|
|
|
|
echo -n "Starting $prog: "
|
|
bacula-checkconf $CONFIG
|
|
daemon $prog $OPTS
|
|
RETVAL=$?
|
|
echo
|
|
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
|
|
return $RETVAL
|
|
}
|
|
|
|
stop() {
|
|
[ "$EUID" != "0" ] && exit 4
|
|
|
|
echo -n "Shutting down $prog: "
|
|
killproc $prog
|
|
RETVAL=$?
|
|
echo
|
|
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
|
|
return $RETVAL
|
|
}
|
|
|
|
case "$1" in
|
|
start)
|
|
start
|
|
;;
|
|
stop)
|
|
stop
|
|
;;
|
|
status)
|
|
status $prog
|
|
;;
|
|
restart|force-reload)
|
|
stop
|
|
sleep 2
|
|
start
|
|
;;
|
|
condrestart|try-restart)
|
|
if [ -f /var/lock/subsys/$prog ]; then
|
|
stop
|
|
sleep 2
|
|
start
|
|
fi
|
|
;;
|
|
*)
|
|
echo "Usage: $prog {start|stop|status|restart|force-reload|condrestart|try-restart}"
|
|
[ "$1" = "usage" ] && exit 0
|
|
exit 2
|
|
;;
|
|
esac
|
|
exit $?
|