Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Initscript cleanup #1

Closed
wants to merge 2 commits into from

2 participants

@jlaska

Greetings,

Just a small set of fixes to the aeolus-conductor initscript to improve operation during system reboots, and improve status reporting when conductor (thin) has died.

I previously sent this to aeolus-devel@ in October, please disregard that patchset. This pull request applies cleanly to origin.

Thanks,
James

jlaska added some commits
@jlaska jlaska Whitespace cleanup 92469f6
@jlaska jlaska BZ 786865: Add THIN_LOCKFILE for improved service shutdown and status
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
5b1d554
@jlaska

This appears to have been merged already back in Feb, 2012.

1b4abca#conf/aeolus-conductor
0d50942#conf/aeolus-conductor

@jguiditta jguiditta closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 2, 2012
  1. @jlaska

    Whitespace cleanup

    jlaska authored
Commits on Feb 3, 2012
  1. @jlaska

    BZ 786865: Add THIN_LOCKFILE for improved service shutdown and status

    jlaska authored
    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
This page is out of date. Refresh to see the latest.
Showing with 44 additions and 39 deletions.
  1. +44 −39 conf/aeolus-conductor
View
83 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,69 +31,73 @@ 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"
- exit 1
+ echo_failure
+ echo
+ echo "${THIN_PROG} is already running"
+ exit 1
fi
$THIN_PROG start -c "$CONDUCTOR_DIR" -l "$THIN_LOG" -P "$THIN_PID" \
- -a $ADDR -e $RAILS_ENV --user $CONDUCTOR_USER -g $CONDUCTOR_GROUP -d --prefix=$PREFIX \
- --rackup "$CONDUCTOR_DIR/config.ru"
+ -a $ADDR -e $RAILS_ENV --user $CONDUCTOR_USER -g $CONDUCTOR_GROUP -d --prefix=$PREFIX \
+ --rackup "$CONDUCTOR_DIR/config.ru"
RETVAL=$?
if [ $RETVAL -eq 0 ] ; then
- # wait until we can contact the server
- # this bit is based on what the mysql init script does
- TIMEOUT="$STARTTIMEOUT"
- while [ $TIMEOUT -gt 0 ]; do
- /usr/bin/curl --silent http://$ADDR:3000$PREFIX >& /dev/null
- RETVAL=$?
- if [ $RETVAL -eq 0 ] ; then
- echo_success
- echo
- exit 0
- fi
- sleep 1
- let TIMEOUT=${TIMEOUT}-1
- done
+ # wait until we can contact the server
+ # this bit is based on what the mysql init script does
+ TIMEOUT="$STARTTIMEOUT"
+ while [ $TIMEOUT -gt 0 ]; do
+ /usr/bin/curl --silent http://$ADDR:3000$PREFIX >& /dev/null
+ RETVAL=$?
+ if [ $RETVAL -eq 0 ] ; then
+ touch ${THIN_LOCKFILE}
+ echo_success
+ echo
+ exit 0
+ fi
+ sleep 1
+ let TIMEOUT=${TIMEOUT}-1
+ done
fi
- echo_failure
- echo
- exit 1
+ echo_failure
+ echo
+ exit 1
}
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
start)
- start
- ;;
+ start
+ ;;
stop)
- stop
- ;;
+ stop
+ ;;
restart)
- stop
- start
- ;;
+ stop
+ start
+ ;;
reload)
;;
force-reload)
restart
;;
status)
- status -p $THIN_PID
- RETVAL=$?
- ;;
+ status -p ${THIN_PID} ${THIN_PROG}
+ RETVAL=$?
+ ;;
*)
- echo "Usage: aeolus-conductor {start|stop|restart|reload|force-reload|status}"
- exit 1
- ;;
+ echo "Usage: aeolus-conductor {start|stop|restart|reload|force-reload|status}"
+ exit 1
+ ;;
esac
exit $RETVAL
Something went wrong with that request. Please try again.