Hello list,
attached a patch which does the following:
- implement actions "configtest" (bacula-dir, bacula-sd, bacula-fd) and
"reload" (bacula-dir only)
- "configtest" checks the config with parameter '-t' and reports the result
- "reload" first checks the config and, if successful, performs a reload via
SIGHUP
- possibility to override the hard-codes daemon config file in
/etc/sysconfig/bacula (variables
DIR_CONFIG, SD_CONFIG, FD_CONFIG)
this is the output:
# /etc/init.d/bacula-dir
Usage: /etc/init.d/bacula-dir {start|stop|restart|reload|status|configtest}
# /etc/init.d/bacula-dir configtest
Checking Bacula Director services config: [ OK ]
# /etc/init.d/bacula-dir reload
Checking Bacula Director services config: [ OK ]
Reloading Bacula Director services: [ OK ]
regards,
-ap
diff -Pur bacula-5.0.3/platforms/redhat/bacula-dir.in bacula-5.0.3.mod/platforms/redhat/bacula-dir.in
--- bacula-5.0.3/platforms/redhat/bacula-dir.in 2010-08-05 16:29:51.000000000 +0200
+++ bacula-5.0.3.mod/platforms/redhat/bacula-dir.in 2010-11-07 23:03:22.000000000 +0100
@@ -17,55 +17,77 @@
DIR_OPTIONS=''
OS=`uname -s`
+dir_conf...@sysconfdir@/bacula-dir.conf
+
# if /lib/tls exists, force Bacula to use the glibc pthreads instead
if [ -d "/lib/tls" -a $OS = "Linux" -a `uname -r | cut -c1-3` = "2.4" ] ; then
export LD_ASSUME_KERNEL=2.4.19
fi
-# pull in any user defined DIR_DIR_OPTIONS, DIR_USER, or DIR_GROUP
+# pull in any user defined DIR_OPTIONS, DIR_USER, DIR_GROUP or DIR_CONFIG
[ -f /etc/sysconfig/bacula ] && . /etc/sysconfig/bacula
+# not user defineable
+dir_pr...@sbindir@/bacula-dir
+lock_fi...@subsysdir@/bacula-dir
+
#
# Disable Glibc malloc checks, it doesn't help and it keeps from getting
# good dumps
MALLOC_CHECK_=0
export MALLOC_CHECK_
+# used by start and configtest
+if [ "${DIR_USER}" != '' ]; then
+ DIR_OPTIONS="${DIR_OPTIONS} -u ${DIR_USER}"
+fi
+
+if [ "${DIR_GROUP}" != '' ]; then
+ DIR_OPTIONS="${DIR_OPTIONS} -g ${DIR_GROUP}"
+fi
+
RETVAL=0
case "$1" in
start)
- if [ "${DIR_USER}" != '' ]; then
- DIR_OPTIONS="${DIR_OPTIONS} -u ${DIR_USER}"
- fi
-
- if [ "${DIR_GROUP}" != '' ]; then
- DIR_OPTIONS="${DIR_OPTIONS} -g ${DIR_GROUP}"
- fi
- echo -n "Starting Bacula Director services: "
- daemon @sbindir@/bacula-dir $2 ${DIR_OPTIONS} -c @sysconfdir@/bacula-dir.conf
+ echo -n $"Starting Bacula Director services: "
+ daemon ${DIR_PROG} $2 ${DIR_OPTIONS} -c ${DIR_CONFIG}
RETVAL=$?
echo
- [ $RETVAL -eq 0 ] && touch @subsysdir@/bacula-dir
+ [ $RETVAL -eq 0 ] && touch ${LOCK_FILE}
;;
stop)
- echo -n "Stopping Bacula Director services: "
- killproc @sbindir@/bacula-dir
+ echo -n $"Stopping Bacula Director services: "
+ killproc ${DIR_PROG}
RETVAL=$?
echo
- [ $RETVAL -eq 0 ] && rm -f @subsysdir@/bacula-dir
+ [ $RETVAL -eq 0 ] && rm -f ${LOCK_FILE}
;;
restart)
- $0 stop
- sleep 5
- $0 start
+ $0 configtest && $0 stop && sleep 5 && $0 start
+ ;;
+ reload)
+ if $0 configtest; then
+ echo -n $"Reloading Bacula Director services: "
+ killproc ${DIR_PROG} -HUP
+ RETVAL=$?
+ echo
+ fi
;;
status)
- status @sbindir@/bacula-dir
+ status ${DIR_PROG}
RETVAL=$?
;;
+ configtest)
+ echo -n "Checking Bacula Director services config: "
+ ${DIR_PROG} -t ${DIR_OPTIONS} -c ${DIR_CONFIG}
+ RETVAL=$?
+ [ $RETVAL -eq 0 ] && echo_success
+ echo
+ ;;
*)
- echo "Usage: $0 {start|stop|restart|status}"
+ echo "Usage: $0 {start|stop|restart|reload|status|configtest}"
exit 1
;;
esac
exit $RETVAL
+
diff -Pur bacula-5.0.3/platforms/redhat/bacula-fd.in bacula-5.0.3.mod/platforms/redhat/bacula-fd.in
--- bacula-5.0.3/platforms/redhat/bacula-fd.in 2010-08-05 16:29:51.000000000 +0200
+++ bacula-5.0.3.mod/platforms/redhat/bacula-fd.in 2010-11-07 22:37:15.000000000 +0100
@@ -17,54 +17,67 @@
FD_OPTIONS=''
OS=`uname -s`
+fd_conf...@sysconfdir@/bacula-fd.conf
+
# if /lib/tls exists, force Bacula to use the glibc pthreads instead
if [ -d "/lib/tls" -a $OS = "Linux" -a `uname -r | cut -c1-3` = "2.4" ] ; then
export LD_ASSUME_KERNEL=2.4.19
fi
-# pull in any user defined FD_OPTIONS, FD_USER, FD_GROUP
+# pull in any user defined FD_OPTIONS, FD_USER, FD_GROUP or FD_CONFIG
[ -f /etc/sysconfig/bacula ] && . /etc/sysconfig/bacula
+# not user defineable
+fd_pr...@sbindir@/bacula-fd
+lock_fi...@subsysdir@/bacula-fd
+
#
# Disable Glibc malloc checks, it doesn't help and it keeps from getting
# good dumps
MALLOC_CHECK_=0
export MALLOC_CHECK_
+# used by start and configtest
+if [ "${FD_USER}" != '' ]; then
+ FD_OPTIONS="${FD_OPTIONS} -u ${FD_USER}"
+fi
+
+if [ "${FD_GROUP}" != '' ]; then
+ FD_OPTIONS="${FD_OPTIONS} -g ${FD_GROUP}"
+fi
+
RETVAL=0
case "$1" in
start)
- if [ "${FD_USER}" != '' ]; then
- FD_OPTIONS="${FD_OPTIONS} -u ${FD_USER}"
- fi
-
- if [ "${FD_GROUP}" != '' ]; then
- FD_OPTIONS="${FD_OPTIONS} -g ${FD_GROUP}"
- fi
echo -n "Starting Bacula File services: "
- daemon @sbindir@/bacula-fd $2 ${FD_OPTIONS} -c @sysconfdir@/bacula-fd.conf
+ daemon ${FD_PROG} $2 ${FD_OPTIONS} -c ${FD_CONFIG}
RETVAL=$?
echo
- [ $RETVAL -eq 0 ] && touch @subsysdir@/bacula-fd
+ [ $RETVAL -eq 0 ] && touch ${LOCK_FILE}
;;
stop)
echo -n "Stopping Bacula File services: "
- killproc @sbindir@/bacula-fd
+ killproc ${FD_PROG}
RETVAL=$?
echo
- [ $RETVAL -eq 0 ] && rm -f @subsysdir@/bacula-fd
+ [ $RETVAL -eq 0 ] && rm -f ${LOCK_FILE}
;;
restart)
- $0 stop
- sleep 5
- $0 start
+ $0 configtest && $0 stop && sleep 5 && $0 start
;;
status)
- status @sbindir@/bacula-fd
+ status ${FD_PROG}
+ RETVAL=$?
+ ;;
+ configtest)
+ echo -n "Checking Bacula File services config: "
+ ${FD_PROG} -t ${FD_OPTIONS} -c ${FD_CONFIG}
RETVAL=$?
+ [ $RETVAL -eq 0 ] && echo_success
+ echo
;;
*)
- echo "Usage: $0 {start|stop|restart|status}"
+ echo "Usage: $0 {start|stop|restart|status|configtest}"
exit 1
;;
esac
diff -Pur bacula-5.0.3/platforms/redhat/bacula-sd.in bacula-5.0.3.mod/platforms/redhat/bacula-sd.in
--- bacula-5.0.3/platforms/redhat/bacula-sd.in 2010-08-05 16:29:51.000000000 +0200
+++ bacula-5.0.3.mod/platforms/redhat/bacula-sd.in 2010-11-07 22:41:17.000000000 +0100
@@ -17,55 +17,67 @@
SD_OPTIONS=''
OS=`uname -s`
+sd_conf...@sysconfdir@/bacula-sd.conf
+
# if /lib/tls exists, force Bacula to use the glibc pthreads instead
if [ -d "/lib/tls" -a $OS = "Linux" -a `uname -r | cut -c1-3` = "2.4" ] ; then
export LD_ASSUME_KERNEL=2.4.19
fi
-# pull in any user defined SD_OPTIONS, SD_USER, or SD_GROUP
+# pull in any user defined SD_OPTIONS, SD_USER, SD_GROUP or SD_CONFIG
[ -f /etc/sysconfig/bacula ] && . /etc/sysconfig/bacula
+# not user defineable
+sd_pr...@sbindir@/bacula-sd
+lock_fi...@subsysdir@/bacula-sd
+
#
# Disable Glibc malloc checks, it doesn't help and it keeps from getting
# good dumps
MALLOC_CHECK_=0
export MALLOC_CHECK_
+# used by start and configtest
+if [ "${SD_USER}" != '' ]; then
+ SD_OPTIONS="${SD_OPTIONS} -u ${SD_USER}"
+fi
+
+if [ "${SD_GROUP}" != '' ]; then
+ SD_OPTIONS="${SD_OPTIONS} -g ${SD_GROUP}"
+fi
+
RETVAL=0
case "$1" in
start)
- if [ "${SD_USER}" != '' ]; then
- SD_OPTIONS="${SD_OPTIONS} -u ${SD_USER}"
- fi
-
- if [ "${SD_GROUP}" != '' ]; then
- SD_OPTIONS="${SD_OPTIONS} -g ${SD_GROUP}"
- fi
-
echo -n "Starting Bacula Storage services: "
- daemon @sbindir@/bacula-sd $2 ${SD_OPTIONS} -c @sysconfdir@/bacula-sd.conf
+ daemon ${SD_PROG} $2 ${SD_OPTIONS} -c ${SD_CONFIG}
RETVAL=$?
echo
- [ $RETVAL -eq 0 ] && touch @subsysdir@/bacula-sd
+ [ $RETVAL -eq 0 ] && touch ${LOCK_FILE}
;;
stop)
echo -n "Stopping Bacula Storage services: "
- killproc @sbindir@/bacula-sd
+ killproc ${SD_PROG}
RETVAL=$?
echo
- [ $RETVAL -eq 0 ] && rm -f @subsysdir@/bacula-sd
+ [ $RETVAL -eq 0 ] && rm -f ${LOCK_FILE}
;;
restart)
- $0 stop
- sleep 5
- $0 start
+ $0 configtest && $0 stop && sleep 5 && $0 start
;;
status)
- status @sbindir@/bacula-sd
+ status ${SD_PROG}
+ RETVAL=$?
+ ;;
+ configtest)
+ echo -n "Checking Bacula Storage services config: "
+ ${SD_PROG} -t ${SD_OPTIONS} -c ${SD_CONFIG}
RETVAL=$?
+ [ $RETVAL -eq 0 ] && echo_success
+ echo
;;
*)
- echo "Usage: $0 {start|stop|restart|status}"
+ echo "Usage: $0 {start|stop|restart|status|configtest}"
exit 1
;;
esac
------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a
Billion" shares his insights and actions to help propel your
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
Bacula-devel mailing list
Bacula-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-devel