File size: 217 Bytes
b2f3bf4
 
 
 
 
 
1
2
3
4
5
6
7
#!/usr/bin/env bash
# usage: scripts/bg.sh <logfile> <command...>   -- fully detached background launch
log="$1"; shift
mkdir -p "$(dirname "$log")"
setsid nohup "$@" > "$log" 2>&1 < /dev/null &
echo "pid $! -> $log"