summaryrefslogtreecommitdiffstats
path: root/redhat
diff options
context:
space:
mode:
authorJohn Morris <john@zultron.com>2012-09-03 13:16:34 -0500
committerSol Jerome <sol.jerome@gmail.com>2012-09-03 15:42:01 -0500
commit2aa47cbf9968ec47847d774f8958253b7ceaded6 (patch)
treeac0c1bcb48b06ff263cb748968b59f180f117fd3 /redhat
parente73fc4c7eead30524b5688ec3580ff845e735e36 (diff)
downloadbcfg2-2aa47cbf9968ec47847d774f8958253b7ceaded6.tar.gz
bcfg2-2aa47cbf9968ec47847d774f8958253b7ceaded6.tar.bz2
bcfg2-2aa47cbf9968ec47847d774f8958253b7ceaded6.zip
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 <sol.jerome@gmail.com>
Diffstat (limited to 'redhat')
-rwxr-xr-xredhat/scripts/bcfg2-server.init14
-rwxr-xr-xredhat/scripts/bcfg2.init57
2 files changed, 28 insertions, 43 deletions
diff --git a/redhat/scripts/bcfg2-server.init b/redhat/scripts/bcfg2-server.init
index 000cc0095..ebeda04bb 100755
--- a/redhat/scripts/bcfg2-server.init
+++ b/redhat/scripts/bcfg2-server.init
@@ -14,6 +14,10 @@ PARAMS="-D $PIDFILE"
prog=$(basename $DAEMON)
conf="/etc/bcfg2.conf"
+# Disabled per default
+BCFG2_SERVER_OPTIONS=""
+BCFG2_SERVER_ENABLED=0
+
PATH=/sbin:/bin:/usr/bin:/usr/sbin
# Source function library
@@ -22,13 +26,19 @@ PATH=/sbin:/bin:/usr/bin:/usr/sbin
# Include default startup configuration if exists
test -f /etc/sysconfig/$prog && . /etc/sysconfig/$prog
+if [ "$BCFG2_SERVER_ENABLED" -eq 0 ] ; then
+ failure $"bcfg2-server is disabled - see /etc/sysconfig/bcfg2-server"
+ echo
+ exit 0
+fi
+
RETVAL=0
start () {
test -x $DAEMON || exit 5
test -f $conf || exit 6
echo -n $"Starting $prog: "
- daemon $DAEMON ${PARAMS}
+ daemon $DAEMON ${PARAMS} ${BCFG2_SERVER_OPTIONS} && success || failure
RETVAL=$?
echo
if test $RETVAL = 0 ; then
@@ -39,7 +49,7 @@ start () {
stop () {
echo -n $"Stopping $prog: "
- killproc ${prog}
+ killproc ${prog} && success || failure
RETVAL=$?
echo
rm -f /var/lock/subsys/$prog
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