From 2aa47cbf9968ec47847d774f8958253b7ceaded6 Mon Sep 17 00:00:00 2001 From: John Morris Date: Mon, 3 Sep 2012 13:16:34 -0500 Subject: redhat init scripts: Update to be more like the debian scripts Fixing this script for RedHat; its advantage over the Debian script is the dependency on lsb drags in quite a number of extra, otherwise- unneeded packages. - Remove agent functions from bcfg2.init - Add success || failure messages - Include options from /etc/sysconfig/bcfg2* - Other snippets from debian script (cherry picked from commit 4034d6e503f1543223355f7aceb6aefd933fabb3) Signed-off-by: Sol Jerome --- redhat/scripts/bcfg2.init | 57 +++++++++++++---------------------------------- 1 file changed, 16 insertions(+), 41 deletions(-) (limited to 'redhat/scripts/bcfg2.init') diff --git a/redhat/scripts/bcfg2.init b/redhat/scripts/bcfg2.init index 8afef2b20..0f867a30f 100755 --- a/redhat/scripts/bcfg2.init +++ b/redhat/scripts/bcfg2.init @@ -9,16 +9,14 @@ # configuration. # -# Set default options -# You can set script specific options with BCFG2_OPTIONS_INIT -# You can set agent-mode specific options with BCFG2_OPTIONS_AGENT DAEMON=/usr/sbin/bcfg2 PIDFILE=/var/run/bcfg2-agent.pid -PARAMS="-q" prog=$(basename $DAEMON) -AGENT_EXTRA_OPTS="-A -i ${PIDFILE}" -# Disabled per default +# Set default options +# You can set script specific options with BCFG2_OPTIONS_INIT +PARAMS="-q" +# Disabled per default BCFG2_ENABLED=0 BCFG2_INIT=0 BCFG2_AGENT=0 @@ -31,27 +29,21 @@ PATH=/sbin:/bin:/usr/bin:/usr/sbin # Include default startup configuration if exists test -f /etc/sysconfig/$prog && . /etc/sysconfig/$prog -# bail out if bcfg2 not enabled -test $BCFG2_ENABLED = 0 && exit 0 +[ "$BCFG2_ENABLED" -eq 0 ] && exit 0 +[ "$BCFG2_INIT" -eq 0 ] && exit 0 + +if [ "$BCFG2_AGENT" != 0 ]; then + echo "Bcfg2 no longer supports agent mode, please update your configuration!" + exit 1 +fi RETVAL=0 start () { test -x $DAEMON || exit 5 echo -n $"Starting $prog: " - if test $BCFG2_AGENT = 1 ; then - daemon $DAEMON ${AGENT_EXTRA_OPTS} $PARAMS ${BCFG2_OPTIONS_AGENT} - RETVAL=$? - echo - if test $RETVAL = 0 ; then - test -d /var/lock/subsys && touch /var/lock/subsys/$prog - else - exit $RETVAL - fi - fi - if test $BCFG2_INIT = 1 ; then - $DAEMON $PARAMS ${BCFG2_OPTIONS_INIT} + $DAEMON $PARAMS ${BCFG2_OPTIONS_INIT} && success || failure RETVAL=$? echo fi @@ -59,35 +51,18 @@ start () { return $RETVAL } -stop () { - echo -n $"Stopping $prog: " - killproc -p $PIDFILE ${BINARY} - RETVAL=$? - echo - rm -f /var/lock/subsys/$prog - return $RETVAL -} - case "$1" in start) start ;; stop) - stop - ;; - status) - status $prog - RETVAL=$? + exit 0 ;; - restart|reload|force-reload) - if test $BCFG2_AGENT = 1 ; then - stop - sleep 5 - start - fi + restart|force-reload) + start ;; *) - echo "Usage: $0 {start|stop|restart|reload|force-reload|status}" + echo "Usage: $0 {start|stop|restart|force-reload}" RETVAL=3 esac -- cgit v1.2.3-1-g7c22