2007-07-24 20:11:04 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# bacula-fd This shell script takes care of starting and stopping
|
|
|
|
# the bacula-fd daemon, the backup client enabling bacula
|
|
|
|
# to backup the local machine.
|
|
|
|
#
|
|
|
|
# chkconfig: - 80 20
|
|
|
|
# description: Bacula-fd is a Backup-client, which is the program \
|
|
|
|
# that enables the bacula-server to backup the local \
|
|
|
|
# machine.
|
|
|
|
# processname: bacula-fd
|
|
|
|
# config: /etc/bacula/bacula-fd.conf
|
|
|
|
# pidfile: /var/run/bacula-fd.9102.pid
|
|
|
|
|
|
|
|
# Source function library.
|
|
|
|
. /etc/init.d/functions
|
|
|
|
|
|
|
|
# Source configuration.
|
|
|
|
if [ -f /etc/sysconfig/bacula-fd ] ; then
|
|
|
|
. /etc/sysconfig/bacula-fd
|
|
|
|
fi
|
|
|
|
|
|
|
|
RETVAL=0
|
|
|
|
prog="bacula-fd"
|
|
|
|
CONFIG="/etc/bacula/bacula-fd.conf"
|
|
|
|
OPTS="-c $CONFIG"
|
|
|
|
|
2010-10-19 15:29:37 +00:00
|
|
|
if [ "$FD_USER" != '' ]; then
|
|
|
|
OPTS="$OPTS -u $FD_USER"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$FD_GROUP" != '' ]; then
|
|
|
|
OPTS="$OPTS -g $FD_GROUP"
|
|
|
|
fi
|
|
|
|
|
2007-07-24 20:11:04 +00:00
|
|
|
checkconf() {
|
|
|
|
# Check if we still have our @@PLACEHOLDERS@@ in the config.
|
|
|
|
# If yes, refuse to start, the user has never touched the config.
|
|
|
|
grep -q '_PASSWORD@@' $CONFIG
|
|
|
|
if [ $? -eq 0 ]; then
|
2010-10-19 15:29:37 +00:00
|
|
|
echo -n "Error: Default password in config"
|
2007-07-24 20:11:04 +00:00
|
|
|
echo_failure
|
|
|
|
echo
|
2010-11-26 09:46:56 +00:00
|
|
|
exit 6
|
2007-07-24 20:11:04 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
start() {
|
2010-06-02 10:29:08 +00:00
|
|
|
[ "$EUID" != "0" ] && exit 4
|
|
|
|
|
2007-07-24 20:11:04 +00:00
|
|
|
echo -n "Starting $prog: "
|
|
|
|
checkconf
|
|
|
|
daemon $prog $OPTS
|
|
|
|
RETVAL=$?
|
|
|
|
echo
|
|
|
|
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
|
|
|
|
return $RETVAL
|
|
|
|
}
|
|
|
|
|
|
|
|
stop() {
|
2010-06-02 10:29:08 +00:00
|
|
|
[ "$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
|
|
|
|
;;
|
2010-06-02 10:29:08 +00:00
|
|
|
restart|force-reload)
|
|
|
|
stop
|
2007-07-24 20:11:04 +00:00
|
|
|
start
|
|
|
|
;;
|
|
|
|
reload)
|
|
|
|
;;
|
2010-06-02 10:29:08 +00:00
|
|
|
condrestart|try-restart)
|
2007-07-24 20:11:04 +00:00
|
|
|
if [ -f /var/lock/subsys/$prog ]; then
|
|
|
|
stop
|
|
|
|
start
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
*)
|
2010-06-02 10:29:08 +00:00
|
|
|
echo "Usage: $prog {start|stop|restart|condrestart|try-restart|reload|force-reload|status|usage}"
|
|
|
|
[ "$1" = "usage" ] && exit 0
|
|
|
|
exit 2
|
2007-07-24 20:11:04 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
exit $?
|