Skip to content

Instantly share code, notes, and snippets.

@bgotink
Created April 22, 2015 14:19
Show Gist options
  • 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