Created
June 27, 2011 13:32
-
-
Save unakatsuo/1048855 to your computer and use it in GitHub Desktop.
hup2term.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# This script converts HUP signal from parent shell to TERM signal. | |
# Terminate the running process which can not be halted with HUP (closing at a GNU screen window). | |
# Usage: | |
# hup2term.sh /usr/sbin/nginx -g \'daemon off\;\' | |
trap 'kill -TERM $wpid;' 1 | |
echo "$*" | |
bash -c "$*" & | |
wpid=$! | |
wait $wpid |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment