Daemonize Go applications with
go get github.com/tozhengxq/godamon
// test.go
package main
import (
"fmt"
"time"
_ "github.com/tozhengxq/godaemon"
)
func main(){
for {
time.Sleep(3*time.Second)
fmt.Println("as")
}
}
$ go run test.go -d=true
[PID] 167