bacula/bacula-sd.init

85 lines
1.5 KiB
Plaintext
Raw Normal View History

2007-07-24 20:11:04 +00:00
#!/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"
2010-10-19 15:29:37 +00:00
if [ "$SD_USER" != '' ]; then
OPTS="$OPTS -u $SD_USER"
fi
if [ "$SD_GROUP" != '' ]; then
OPTS="$OPTS -g $SD_GROUP"
fi
2007-07-24 20:11:04 +00:00
start() {
[ "$EUID" != "0" ] && exit 4
2007-07-24 20:11:04 +00:00
echo -n "Starting $prog: "
bacula-checkconf $CONFIG
2007-07-24 20:11:04 +00:00
daemon $prog $OPTS
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
return $RETVAL
}
stop() {
[ "$EUID" != "0" ] && exit 4
2007-07-24 20:11:04 +00:00
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
2007-07-24 20:11:04 +00:00
start
;;
condrestart|try-restart)
2007-07-24 20:11:04 +00:00
if [ -f /var/lock/subsys/$prog ]; then
stop
start
fi
;;
*)
2012-06-19 09:58:54 +00:00
echo "Usage: $prog {start|stop|status|restart|force-reload|condrestart|try-restart}"
[ "$1" = "usage" ] && exit 0
exit 2
2007-07-24 20:11:04 +00:00
;;
esac
exit $?