Created
June 21, 2014 21:18
-
-
Save mikesmullin/b6e91e2102163e8486bc to your computer and use it in GitHub Desktop.
Bash Process Loop
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 | |
# Process Loop | |
# Author: Mike Smullin <mike@smullindesign.com> | |
# License: MIT | |
# Usage: | |
# | |
# ./loop node --debug app.js | |
# | |
# Ctrl+C Restarts | |
# Ctrl+\ Quits | |
# | |
ctrl_c() { | |
echo -en "\n\n*** Restarting ***\n\n" | |
} | |
ctrl_backslash() { | |
echo -en "\n\n*** Killing ***\n\n" | |
exit 0 | |
} | |
# trap keyboard interrupt (control-c) | |
trap ctrl_c SIGINT | |
trap ctrl_backslash SIGQUIT | |
# the loop | |
reset; while true; do $*; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment