The following is a simple (and very row) init script for Bacula 5.0.
I wrote it because I really hate to execute script not registered with chkconfig on a production systems.
The following is the script :
#!/bin/sh
#
# BACULA Control Script
# chkconfig: 2345 99 01
# Description: Here is a little startup/shutdown script for RedHat/CentOS systems
#
# processname: bacula
# bacula-dir pidfile: /var/run/bacula-dir.9101.pid
# bacula-fd pidfile: /var/run/bacula-fd.9102.pid
# bacula-sd pidfile: /var/run/bacula-sd.9103.pid
#
# bacula-dir config: /etc/bacula/bacula-dir.conf
# bacula-fd config: /etc/bacula/bacula-fd.conf
# bacula-sd config: /etc/bacula/bacula-sd.conf
#
# Author : Riccardo Riva
#
# description: It comes by night and sucks the vital essence from your computers.
#
SCRIPTDIR=/etc/bacula
#
# Disable Glibc malloc checks, it doesn't help and it keeps from getting
# good dumps
MALLOC_CHECK_=0
export MALLOC_CHECK_
# Source function library.
. /etc/rc.d/init.d/functions
RETVAL=0
# See how we were called.
case "$1" in
start)
[ -x ${SCRIPTDIR}/bacula-ctl-sd ] && ${SCRIPTDIR}/bacula-ctl-sd $1 $2
[ -x ${SCRIPTDIR}/bacula-ctl-fd ] && ${SCRIPTDIR}/bacula-ctl-fd $1 $2
[ -x ${SCRIPTDIR}/bacula-ctl-dir ] && ${SCRIPTDIR}/bacula-ctl-dir $1 $2
;;
stop)
# Stop the FD first so that SD will fail jobs and update catalog
[ -x ${SCRIPTDIR}/bacula-ctl-fd ] && ${SCRIPTDIR}/bacula-ctl-fd $1 $2
[ -x ${SCRIPTDIR}/bacula-ctl-sd ] && ${SCRIPTDIR}/bacula-ctl-sd $1 $2
[ -x ${SCRIPTDIR}/bacula-ctl-dir ] && ${SCRIPTDIR}/bacula-ctl-dir $1 $2
;;
restart)
$0 stop
sleep 2
$0 start
;;
status)
[ -x ${SCRIPTDIR}/bacula-ctl-sd ] && ${SCRIPTDIR}/bacula-ctl-sd status
[ -x ${SCRIPTDIR}/bacula-ctl-fd ] && ${SCRIPTDIR}/bacula-ctl-fd status
[ -x ${SCRIPTDIR}/bacula-ctl-dir ] && ${SCRIPTDIR}/bacula-ctl-dir status
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
;;
esac
exit $RETVAL
#--- End of file ---
You should download the script from here :
http://www.riccardoriva.com/shared-files/bacula_init_script.sh
Hope this help
Bye
Riccardo
Print This Post























