# HG changeset patch # User Goffi # Date 1457130246 -3600 # Node ID 7a07f232e7cb383b676d13212a06e25973c7915d # Parent a97db84c048de43494c60e3466bf7e3308c20c36 misc (sat.sh): exec + better stop: - use exec to launch twistd which is specially useful in foreground mode, so signals and other stuff are handled correctly - sat.sh stop now wait until the backend is actually stopped before exiting (before it was just sending the signal and leaving) diff -r a97db84c048d -r 7a07f232e7cb src/sat.sh --- a/src/sat.sh Fri Mar 04 11:22:41 2016 +0100 +++ b/src/sat.sh Fri Mar 04 23:24:06 2016 +0100 @@ -9,8 +9,12 @@ if [ -f $1 ]; then PID=`cat $1` if ps -p $PID > /dev/null; then - echo "Terminating $2... " + printf "Terminating $2... " kill $PID + while ps -p $PID > /dev/null; do + sleep 0.2 + done + printf "OK\n" else echo "No running process of ID $PID... removing PID file" rm -f $1 @@ -99,4 +103,4 @@ mkdir $log_dir fi -twistd $MAIN_OPTIONS $ADDITIONAL_OPTIONS $APP_NAME_FILE +exec twistd $MAIN_OPTIONS $ADDITIONAL_OPTIONS $APP_NAME_FILE