diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2006-07-31 18:56:31 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2006-07-31 18:56:31 +0000 |
commit | c550619429671a01f61524273a1a79a110b843a3 (patch) | |
tree | 37656631f7c237567309b2b41bb8505ccb1a373e | |
parent | 80394f3e3f4d36936dae1a38186786edba780f82 (diff) | |
download | bcfg2-c550619429671a01f61524273a1a79a110b843a3.tar.gz bcfg2-c550619429671a01f61524273a1a79a110b843a3.tar.bz2 bcfg2-c550619429671a01f61524273a1a79a110b843a3.zip |
LSB updates from Ressu (should resolve ticket #81)
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2017 ce84e21b-d406-0410-9b95-82705330c041
-rw-r--r-- | debian/bcfg2-server.init | 48 | ||||
-rw-r--r-- | debian/bcfg2.init | 17 | ||||
-rw-r--r-- | misc/bcfg2.spec | 1 |
3 files changed, 51 insertions, 15 deletions
diff --git a/debian/bcfg2-server.init b/debian/bcfg2-server.init index d2d82bd10..5a51056f2 100644 --- a/debian/bcfg2-server.init +++ b/debian/bcfg2-server.init @@ -26,27 +26,61 @@ test -x $DAEMON || exit 5 # Include lsb functions . /lib/lsb/init-functions +# Internal variables +BINARY=$(basename $DAEMON) + case "$1" in start) - log_begin_msg "Starting Configuration Management Server" - log_progress_msg "bcfg2-server" + echo -n "Starting Configuration Management Server: " start_daemon ${DAEMON} ${PARAMS} - log_end_msg $? + STATUS=$? + if [ "$STATUS" = 0 ] + then + log_success_msg "bcfg2-server" + else + log_failure_msg "bcfg2-server" + fi + exit $STATUS ;; stop) - log_begin_msg "Stopping Configuration Management Server" - log_progress_msg "bcfg2-server" - killproc -p "${PIDFILE}" ${DAEMON} - log_end_msg $? + echo -n "Stopping Configuration Management Server: " + killproc ${BINARY} + STATUS=$? + if [ "$STATUS" = 0 ]; then + log_success_msg "bcfg2-server" + exit 0 + else + log_failure_msg "bcfg2-server" + fi + exit $STATUS ;; force-reload|restart) $0 stop sleep 5 $0 start ;; + status) + # Inspired by redhat /etc/init.d/functions status() call + PID=$(pidof -x $BINARY) + if [ -n "$PID" ]; then + echo "$BINARY (pid $PID) is running..." + exit 0 + fi + + if [ -f $PIDFILE ]; then + if [ -n "$PID" ]; then + echo "$BINARY dead but pid file exists..." + exit 1 + fi + fi + + echo "$BINARY is not running" + exit 3 + ;; *) log_success_msg "Usage: bcfg2-server {start|stop|restart|force-reload}" exit 1 + ;; esac exit 0 diff --git a/debian/bcfg2.init b/debian/bcfg2.init index 8da1209d4..e7466f18d 100644 --- a/debian/bcfg2.init +++ b/debian/bcfg2.init @@ -40,15 +40,16 @@ test -x $BCFG2 || exit 5 case "$1" in start) - log_begin_msg "Running configuration management client" - if test -e /etc/donttouchme; then - rm -f /etc/donttouchme - log_success_msg "bcfg2 does not need to run." + echo -n "Running configuration management client: " + ${BCFG2} ${BCFG2_OPTIONS} + STATUS=$? + if [ "$STATUS" = 0 ] + then + log_success_msg "bcfg2" else - log_progress_msg "bcfg2" - /usr/sbin/bcfg2 $BCFG2_OPTIONS - log_end_msg $? + log_failure_msg "bcfg2" fi + exit $STATUS ;; restart) $0 stop @@ -62,7 +63,7 @@ case "$1" in true ;; *) - log_success_msg "Usage: $0 {start|stop|restart|force-reload|status}" + echo "Usage: $0 {start|stop|restart|force-reload|status}" exit 1 esac diff --git a/misc/bcfg2.spec b/misc/bcfg2.spec index 0703ccefd..cd7f314ae 100644 --- a/misc/bcfg2.spec +++ b/misc/bcfg2.spec @@ -14,6 +14,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot Prefix: %{_prefix} BuildArchitectures: noarch Vendor: Narayan Desai <desai@mcs.anl.gov> +PreReq: lsb >= 3.0 Requires: lxml, python %description |