Quantcast
Channel: Forward SIGTERM to child in Bash - Unix & Linux Stack Exchange
Browsing latest articles
Browse All 6 View Live

Answer by SensorSmith for Forward SIGTERM to child in Bash

Andreas Veithen points out that if you do not need to return from the call (like in the OP's example) simply calling through the exec command is sufficient (@Stuart P. Bentley's answer). Otherwise the...

View Article



Answer by user1463361 for Forward SIGTERM to child in Bash

Provided solution doesn't work for me because process was killed before the wait command actually finished. I found that article http://veithen.github.io/2014/11/16/sigterm-propagation.html, the last...

View Article

Answer by Stuart P. Bentley for Forward SIGTERM to child in Bash

Bash does not forward signals like SIGTERM to processes it is currently waiting on. If you want to end your script by segueing into your server (allowing it to handle signals and anything else, as if...

View Article

Answer by cuonglm for Forward SIGTERM to child in Bash

Try: #!/bin/bash _term() { echo "Caught SIGTERM signal!" kill -TERM "$child" 2>/dev/null } trap _term SIGTERM echo "Doing some initial work..."; /bin/start/main/server --nodaemon & child=$! wait...

View Article

Forward SIGTERM to child in Bash

I have a Bash script, which looks similar to this: #!/bin/bash echo "Doing some initial work...."; /bin/start/main/server --nodaemon Now if the bash shell running the script receives a SIGTERM signal,...

View Article


Answer by mathmax for Forward SIGTERM to child in Bash

To add a few points to the above answers:Starting the process in the background with '&' and wait for its pid as advised by @cuonglm will make it possible for the handler to execute while the child...

View Article
Browsing latest articles
Browse All 6 View Live


Latest Images