1、下载

git clone https://github.com/fiorix/go-daemon
cd go-daemon
make && make install

2、run –help

god --help
Use: god [options] [--] program [arguments]
Options:
-h --help           show this help and exit
-v --version        show version and exit
-f --foreground     run in foreground
-n --nohup          make the program immune to SIGHUP
-l --logfile FILE   write the program's stdout and stderr to FILE
-p --pidfile FILE   write pid to FILE
-r --rundir DIR     switch to DIR before executing the program
-u --user USER      switch to USER before executing the program
-g --group GROUP    switch to GROUP before executing the program

The program's output go to a blackhole if no logfile is set.
Log files are recycled on SIGHUP.

3、example

god --nohup --pidfile /var/run/hugo.pid -- /usr/local/bin/hugo server --source /data/demo --appendPort=false -D