Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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