I liked SensorSmith answer at Forward SIGTERM to child in Bash, but for my systemctl
script, it resulted in a double SIGTERM, because systemctl
sends SIGTERM to the parent bash instance AND the child I am running. The result was instant termination before my child could gracefully shut down.
What's the proper way to handle SIGTERM in a bash script based service?