summaryrefslogtreecommitdiffstats
path: root/debian
diff options
context:
space:
mode:
authorJoey Hagedorn <hagedorn@mcs.anl.gov>2007-07-25 15:40:57 +0000
committerJoey Hagedorn <hagedorn@mcs.anl.gov>2007-07-25 15:40:57 +0000
commita464344029d9438db0fa419ee386a43184f4e818 (patch)
tree285065570bb1285ee34956413687490cb826b8cf /debian
parent8427842859e2e72ea4c9b373ffd8a9aeb0f2d31b (diff)
downloadbcfg2-a464344029d9438db0fa419ee386a43184f4e818.tar.gz
bcfg2-a464344029d9438db0fa419ee386a43184f4e818.tar.bz2
bcfg2-a464344029d9438db0fa419ee386a43184f4e818.zip
updated init script for agent mode
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@3563 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'debian')
-rw-r--r--debian/bcfg2.default7
-rw-r--r--debian/buildsys/common/bcfg2.init44
2 files changed, 47 insertions, 4 deletions
diff --git a/debian/bcfg2.default b/debian/bcfg2.default
index 80dc94cca..03ecdfbd4 100644
--- a/debian/bcfg2.default
+++ b/debian/bcfg2.default
@@ -19,6 +19,13 @@
# Default: 0 (disable)
#BCFG2_INIT=1
+# BCFG2_AGENT:
+# Run Bcfg2 in Agent mode at system bootup
+#
+# Set value to 1 to enable
+# Default: 0 (disable)
+#BCFG2_AGENT=1
+
# BCFG2_CRON:
# Set the frequency of cron runs.
#
diff --git a/debian/buildsys/common/bcfg2.init b/debian/buildsys/common/bcfg2.init
index db7fd1349..a082e17e5 100644
--- a/debian/buildsys/common/bcfg2.init
+++ b/debian/buildsys/common/bcfg2.init
@@ -28,6 +28,7 @@ BCFG2_OPTIONS="-q"
# Disabled per default
BCFG2_ENABLED=0
BCFG2_INIT=0
+BCFG2_AGENT=0
# Include default startup configuration if exists
test -f "/etc/default/bcfg2" && . /etc/default/bcfg2
@@ -37,14 +38,26 @@ test -f "/etc/default/bcfg2" && . /etc/default/bcfg2
# Exit if bcfg2 doesn't exist and is not executable
test -x $BCFG2 || exit 5
+# Agent mode daemon capability
+DAEMON_PARAMS="-A"
+PIDFILE=/var/run/bcfg2.pid
+# Internal variables
+BINARY=$(basename $BCFG2)
+
# Include lsb functions
. /lib/lsb/init-functions
case "$1" in
start)
echo -n "Running configuration management client: "
- ${BCFG2} ${BCFG2_OPTIONS} ${BCFG2_OPTIONS_INIT}
- STATUS=$?
+ if ["$BCFG2_AGENT" = 1]
+ start_daemon ${BCFG2} ${DAEMON_PARAMS} ${BCFG2_OPTIONS} ${BCFG2_OPTIONS_INIT}
+ STATUS=$?
+ else
+ ${BCFG2} ${BCFG2_OPTIONS} ${BCFG2_OPTIONS_INIT}
+ STATUS=$?
+ fi
+
if [ "$STATUS" = 0 ]
then
log_success_msg "bcfg2"
@@ -57,8 +70,31 @@ case "$1" in
# Since we are always OK, always return OK as status
exit 0
;;
- restart|reload|stop|force-reload)
- true
+ stop)
+ if ["$BCFG2_AGENT" = 1]
+ echo -n "Stopping configuration management client daemon: "
+ killproc ${BINARY}
+ STATUS=$?
+ if [ "$STATUS" = 0 ]; then
+ log_success_msg "bcfg2"
+ exit 0
+ else
+ log_failure_msg "bcfg2"
+ fi
+ exit $STATUS
+
+ else
+ true
+ fi
+ ;;
+ restart|reload|force-reload)
+ if ["$BCFG2_AGENT" = 1]
+ $0 stop
+ sleep 5
+ $0 start
+ else
+ true
+ fi
;;
*)
echo "Usage: $0 {start|stop|restart|reload|force-reload|status}"