[25525] in Source-Commits
/svn/athena r25055 - trunk/third/moira/debian
daemon@ATHENA.MIT.EDU (Jonathan D Reed)
Wed Mar 16 15:49:36 2011
Date: Wed, 16 Mar 2011 15:49:30 -0400
From: Jonathan D Reed <jdreed@MIT.EDU>
Message-Id: <201103161949.p2GJnUAI001042@drugstore.mit.edu>
To: source-commits@mit.edu
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Author: jdreed
Date: 2011-03-16 15:49:30 -0400 (Wed, 16 Mar 2011)
New Revision: 25055
Modified:
trunk/third/moira/debian/debathena-moira-update-server.init
Log:
Always create the PID file after starting the daemon
Modified: trunk/third/moira/debian/debathena-moira-update-server.init
===================================================================
--- trunk/third/moira/debian/debathena-moira-update-server.init 2011-03-16 19:19:27 UTC (rev 25054)
+++ trunk/third/moira/debian/debathena-moira-update-server.init 2011-03-16 19:49:30 UTC (rev 25055)
@@ -53,8 +53,9 @@
# capable of writing its own pidfile
PID="$(pgrep -f $DAEMON)"
if [ -n "$PID" ]; then
- if [ -f "$PIDFILE" ] && \
- [ "$(cat $PIDFILE)" != "$PID" ]; then
+ if ! [ -f "$PIDFILE" ]; then
+ echo "$PID" > $PIDFILE
+ elif [ "$(cat $PIDFILE)" != "$PID" ]; then
rm -f $PIDFILE
echo "$PID" > $PIDFILE
fi
@@ -69,14 +70,11 @@
# Remove the following once #849 is fixed and update_server is
# capable of writing its own pidfile
sleep 1
+ # If we got here, we successfully started the daemon,
+ # so overwrite the PID file
+ rm -f $PIDFILE
PID="$(pgrep -f $DAEMON)"
- if [ -n "$PID" ]; then
- if [ -f "$PIDFILE" ] && \
- [ "$(cat $PIDFILE)" != "$PID" ]; then
- rm -f $PIDFILE
- echo "$PID" > $PIDFILE
- fi
- fi
+ echo "$PID" > $PIDFILE
# Add code here, if necessary, that waits for the process to be ready
# to handle requests from services started subsequently which depend
# on this one. As a last resort, sleep for some time.