1、下载

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

2、run –help

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
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

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