Created
July 8, 2020 09:49
-
-
Save r10r/eae7d1ec9e14f1064bd198a3ba056bdc to your computer and use it in GitHub Desktop.
Self terminate shell script after deadline.
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 | |
PID=$$ | |
deadline() { | |
sleep $1 | |
kill $PID | |
} | |
export deadline | |
deadline 2 & | |
while true; do | |
echo "waiting" | |
sleep 1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment