summaryrefslogtreecommitdiffstats
path: root/debian
diff options
context:
space:
mode:
Diffstat (limited to 'debian')
-rw-r--r--debian/bcfg2-server.init48
-rw-r--r--debian/bcfg2.init17
2 files changed, 50 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