From f71e2451d7bef74328eecde318d8c0d21d5b3651 Mon Sep 17 00:00:00 2001 From: Goffi Date: Fri, 4 Mar 2016 23:24:06 +0100 Subject: [PATCH] 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) --- src/sat.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/sat.sh b/src/sat.sh index 4f9a866d..068441ee 100755 --- a/src/sat.sh +++ b/src/sat.sh @@ -9,8 +9,12 @@ kill_process() { 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 @@ if [ ! -d $log_dir ] ; then mkdir $log_dir fi -twistd $MAIN_OPTIONS $ADDITIONAL_OPTIONS $APP_NAME_FILE +exec twistd $MAIN_OPTIONS $ADDITIONAL_OPTIONS $APP_NAME_FILE