summaryrefslogtreecommitdiffstats
path: root/debian/bcfg2-server.init
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2006-07-31 18:56:31 +0000
committerNarayan Desai <desai@mcs.anl.gov>2006-07-31 18:56:31 +0000
commitc550619429671a01f61524273a1a79a110b843a3 (patch)
tree37656631f7c237567309b2b41bb8505ccb1a373e /debian/bcfg2-server.init
parent80394f3e3f4d36936dae1a38186786edba780f82 (diff)
downloadbcfg2-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
Diffstat (limited to 'debian/bcfg2-server.init')
-rw-r--r--debian/bcfg2-server.init48
1 files changed, 41 insertions, 7 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