#!/bin/bash # # bacula-dir This shell script takes care of starting and stopping # the bacula-dir daemon, the backup director controling # the backup jobs. # # chkconfig: - 80 20 # description: Bacula-dir is the Backup-server, which is the program \ # that schedules backups and controls the bacula-client and \ # the bacula-storage daemons. # processname: bacula-dir # config: /etc/bacula/bacula-dir.conf # pidfile: /var/run/bacula-dir.9101.pid # Source function library. . /etc/init.d/functions # Source configuration. if [ -f /etc/sysconfig/bacula-dir ] ; then . /etc/sysconfig/bacula-dir fi RETVAL=0 prog="bacula-dir" CONFIG="/etc/bacula/bacula-dir.conf" OPTS="-c $CONFIG" if [ "$DIR_USER" != '' ]; then OPTS="$OPTS -u $DIR_USER" fi if [ "$DIR_GROUP" != '' ]; then OPTS="$OPTS -g $DIR_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 start ;; condrestart|try-restart) if [ -f /var/lock/subsys/$prog ]; then stop start fi ;; *) echo "Usage: $prog {start|stop|status|restart|force-reload|condrestart|try-restart}" [ "$1" = "usage" ] && exit 0 exit 2 ;; esac exit $?