#! /bin/sh # # bacula This shell script takes care of starting and stopping # the bacula File daemon. # # chkconfig: 2345 90 9 # description: It comes by night and sucks the vital essence from your computers. # # For Bacula release 5.2.13 (19 February 2013) -- mageia # ### BEGIN INIT INFO # Provides: bacula-fd # Required-Start: $local_fs $network # Required-Stop: $local_fs $network # Default-Start: 3 5 # Default-Stop: 0 1 2 6 # Short-Description: bacula file daemon # Description: Bacula network backup system file daemon ### END INIT INFO # Source function library . /etc/rc.d/init.d/functions FD_USER=bacula FD_GROUP=bacula FD_KEEP_READALL=yes FD_OPTIONS='' FD_IONICE='' # pull in any user defined FD_OPTIONS, FD_USER, or FD_GROUP [ -f /etc/sysconfig/bacula ] && . /etc/sysconfig/bacula FD_PORT=`grep -i '^[[:space:]]*FDPort' /etc/bacula/bacula-fd.conf |sed -e 's/^.*=[[:space:]]*\([0-9]*\).*$/\1/'` PIDFILE=/var/run/bacula-fd.${FD_PORT:-9102}.pid OLDPIDFILE=/var/run/bacula-fd.pid case "$1" in start) if [ "${FD_USER}" != '' ]; then FD_OPTIONS="${FD_OPTIONS} -u ${FD_USER}" case "$FD_KEEP_READALL" in [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]) FD_OPTIONS="${FD_OPTIONS} -k" ;; esac fi if [ "${FD_GROUP}" != '' ]; then FD_OPTIONS="${FD_OPTIONS} -g ${FD_GROUP}" fi if [ -n "$FD_IONICE" -a -x /usr/bin/ionice ]; then IONICE="/usr/bin/ionice $FD_IONICE" fi gprintf "Starting the Bacula File daemon: " daemon --pidfile=$PIDFILE $IONICE /usr/sbin/bacula-fd $FD_OPTIONS -c /etc/bacula/bacula-fd.conf RETVAL=$? echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/bacula-fd ;; stop) gprintf "Stopping the Bacula File daemon: " [ -e $OLDPIDFILE ] && killproc -p $OLDPIDFILE /usr/sbin/bacula-fd killproc -p $PIDFILE /usr/sbin/bacula-fd RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/bacula-fd ;; restart) $0 stop sleep 5 $0 start ;; condrestart) [ -f /var/lock/subsys/bacula-fd ] && $0 restart ;; status) status -p $PIDFILE /usr/sbin/bacula-fd ;; *) gprintf "Usage: %s {start|stop|restart|status}\n" "$0" exit 1 ;; esac exit 0