mirror of
https://github.com/antos-rde/antos.git
synced 2025-02-22 19:12:46 +01:00
fix: proper way to handle signal + wait for process
This commit is contained in:
parent
b2d766849c
commit
860b61b04e
@ -1 +1 @@
|
|||||||
Subproject commit 58a7738afee006a1a816bfab15ae54e879eb723a
|
Subproject commit 4f91f99ca00d269a35f731a00d6ace31b59c8bb0
|
@ -15,7 +15,28 @@ unset ANTOS_PASSWORD
|
|||||||
syslogd -O /tmp/message
|
syslogd -O /tmp/message
|
||||||
|
|
||||||
antd /opt/www/etc/antd-config.ini &
|
antd /opt/www/etc/antd-config.ini &
|
||||||
|
pid=$!
|
||||||
sleep 2
|
sleep 2
|
||||||
runner /opt/www/etc/runner.ini &
|
runner /opt/www/etc/runner.ini &
|
||||||
|
#pid_runner=$!
|
||||||
|
|
||||||
cat
|
for signal in TERM USR1 HUP INT; do
|
||||||
|
# shellcheck disable=SC2064
|
||||||
|
trap "echo SIGNAL: $signal; kill -s $signal $pid" $signal
|
||||||
|
done
|
||||||
|
|
||||||
|
# USR2 converted to WINCH
|
||||||
|
# shellcheck disable=SC2064
|
||||||
|
trap "kill -s WINCH $pid" USR2
|
||||||
|
|
||||||
|
status=999
|
||||||
|
while true; do
|
||||||
|
if [ "${status}" -le 128 ]; then
|
||||||
|
# Status codes larger than 128 indicates a trapped signal terminated the wait command (128 + SIGNAL).
|
||||||
|
# In any other case we can stop the loop.
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
wait $pid
|
||||||
|
status=$?
|
||||||
|
echo exit status: $status
|
||||||
|
done
|
Loading…
x
Reference in New Issue
Block a user