Modify wrapper to use PGID when terminating app
This commit is contained in:
parent
bbe9880db3
commit
628b3dc562
@ -8,24 +8,25 @@
|
|||||||
|
|
||||||
source "$(dirname "${0}")"/../script/include/global_header.inc.sh
|
source "$(dirname "${0}")"/../script/include/global_header.inc.sh
|
||||||
|
|
||||||
# Create a function to trap signals with
|
# Create a function to run after a trap is triggered
|
||||||
reap() {
|
reap() {
|
||||||
kill -TERM "${child}"
|
kill -s SIGTERM -- "-$$"
|
||||||
sleep 0.1
|
sleep 0.1
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|
||||||
# Register trap
|
# Register trapping of SIGTERM and SIGINT
|
||||||
trap reap TERM INT
|
trap reap SIGTERM SIGINT
|
||||||
|
|
||||||
|
# Display the script PID, which will also be the process group ID for all
|
||||||
|
# child processes
|
||||||
|
echo "Process Group: $$"
|
||||||
|
|
||||||
# Set server launch related environment variables
|
# Set server launch related environment variables
|
||||||
DEBUG=1
|
DEBUG=1
|
||||||
LAUNCH_ARGS="$*"
|
LAUNCH_ARGS="$*"
|
||||||
|
|
||||||
|
|
||||||
# Launch the app
|
# Launch the app
|
||||||
source ./script/server
|
source ./script/server &
|
||||||
|
wait
|
||||||
# Capture the PID of the child process
|
|
||||||
child=$!
|
|
||||||
|
|
||||||
wait $child
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user