Created
April 22, 2015 14:19
-
-
Save bgotink/302b47d4830c310d3fb8 to your computer and use it in GitHub Desktop.
background-example.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
background() { | |
local pidfile="$1" | |
local logfile="$2" | |
shift; shift; | |
echo $BASHPID > "$pidfile" | |
exec "$@" >"$logfile" 2>&1 | |
} | |
(background /path/to/my.pid /path/to/my.log my_program --my=options my arguments) & |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment