first rotate the pid file then write the new PID to it

This commit is contained in:
Gunter Labes 2009-04-14 20:36:39 +00:00
parent f71ef9f4fd
commit 8d4b01ed68

View file

@ -73,13 +73,13 @@ do
$COMMAND &> "$SERVERBASE/logs/$LOG" &
PID=$!
echo $PID > $SERVERBASE/current.pid
echo "started $SERVER server with command: '$COMMAND' (revision: $REV, pid: $PID) logging to: $LOG"
# create some convenient links
ln -s "$SERVERBASE/logs/$LOG" "$LOG.$PID"
rm -f $SERVERBASE/old.{log,pid}
mv $SERVERBASE/current.log $SERVERBASE/old.log &> /dev/null
mv $SERVERBASE/current.pid $SERVERBASE/old.pid &> /dev/null
echo $PID > $SERVERBASE/current.pid
ln -s "logs/$LOG" $SERVERBASE/current.log
# wait for the server to terminate
wait $PID