Created
April 13, 2015 22:27
-
-
Save srkiNZ84/dcd5b3c7e2c1d1920bd7 to your computer and use it in GitHub Desktop.
Simple script to test/demo simple signal handling in bash
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/bash | |
function sigusr1 { | |
echo "Received SIGUSR1." | |
STOP_EXECUTION=1 | |
echo "Stopping execution after current item" | |
} | |
trap 'sigusr1' USR1 | |
STOP_EXECUTION=0 | |
while ((!STOP_EXECUTION)); do | |
echo "Running..." | |
sleep 5 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment