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)
This commit is contained in:
Goffi 2016-03-04 23:24:06 +01:00
commit f71e2451d7

View file

@ -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