Skip to content

Instantly share code, notes, and snippets.

@bgotink
Created April 22, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bgotink/302b47d4830c310d3fb8 to your computer and use it in GitHub Desktop.
Save bgotink/302b47d4830c310d3fb8 to your computer and use it in GitHub Desktop.
background-example.bash
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