[PATCH 2/2] BZ 786865: Add THIN_LOCKFILE for improved service shutdown and status
James Laska
jlaska at redhat.com
Fri Feb 3 17:31:22 UTC 2012
https://bugzilla.redhat.com/show_bug.cgi?id=786865
In the event that the thin process has died for some reason, service
status will report:
> # service aeolus-conductor status
> is stopped
The use of a LOCKFILE corrects the output, in addition to improved
handling during system shutdown (/etc/init.d/killall):
> # service aeolus-conductor status
> aeolus-conductor dead but subsys locked
---
conf/aeolus-conductor | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/conf/aeolus-conductor b/conf/aeolus-conductor
index 52ae9dd..ccc4235 100755
--- a/conf/aeolus-conductor
+++ b/conf/aeolus-conductor
@@ -19,6 +19,7 @@ CONDUCTOR_GROUP="${CONDUCTOR_GROUP:-aeolus}"
THIN_PROG="${THIN_PROG:-thin}"
THIN_PID="${THIN_PID:-/var/run/aeolus-conductor/thin.pid}"
THIN_LOG="${THIN_LOG:-/var/log/aeolus-conductor/thin.log}"
+THIN_LOCKFILE="${THIN_LOCKFILE:-/var/lock/subsys/aeolus-conductor}"
PREFIX="${PREFIX:-/conductor}"
ADDR="${ADDR:-127.0.0.1}"
@@ -30,11 +31,11 @@ STARTTIMEOUT=60
. /etc/init.d/functions
start() {
- echo -n "Starting aeolus-conductor: "
+ echo -n "Starting ${THIN_PROG}: "
if [ -f "$THIN_PID" ] && checkpid `cat $THIN_PID` ; then
echo_failure
echo
- echo "Thin is already running"
+ echo "${THIN_PROG} is already running"
exit 1
fi
@@ -50,6 +51,7 @@ start() {
/usr/bin/curl --silent http://$ADDR:3000$PREFIX >& /dev/null
RETVAL=$?
if [ $RETVAL -eq 0 ] ; then
+ touch ${THIN_LOCKFILE}
echo_success
echo
exit 0
@@ -65,8 +67,11 @@ start() {
}
stop() {
- echo -n "Shutting down aeolus-conductor: "
- killproc -p $THIN_PID thin
+ echo -n "Shutting down ${THIN_PROG}: "
+ killproc -p $THIN_PID ${THIN_PROG}
+ RETVAL=$?
+ echo
+ [ $RETVAL = 0 ] && rm -f ${THIN_LOCKFILE} ${THIN_PID}
}
case "$1" in
@@ -86,7 +91,7 @@ case "$1" in
restart
;;
status)
- status -p $THIN_PID
+ status -p ${THIN_PID} ${THIN_PROG}
RETVAL=$?
;;
*)
--
1.7.7.6
More information about the aeolus-devel
mailing list