go-daemon
go-daemon copied to clipboard
A library for writing system daemons in golang.
[Unit] Description=Golang HTTP Server After=network-online.target remote-fs.target nss-lookup.target Wants=network-online.target [Service] Type=forking PIDFile=/home/sample.pid ExecStart=/home/daemon/go-test ExecReload=/home/daemon/go-test -s reload ExecStop=/home/daemon/go-test -s stop KillMode=none PrivateTmp=false Restart=on-failure RestartSec=5 CPUAccounting=false TasksAccounting=false MemoryAccounting=false [Install] WantedBy=multi-user.target Alias=gotest.service
``` ctx := &daemon.Context{} d, err := ctx.Reborn() if err != nil { // When I use exec.Command to execute the sh script and the sh script starts this program,...
After reborn, the new process get `pgid` the same as it's process id by default. I need to be able to customize the pgid so that I could kill it...
Hey thanks for building this awesome project, but I've been having issues using this tool and cobra. If you have an example I can look into I would appreciate it....
[the sample](https://github.com/sevlyar/go-daemon/blob/master/examples/cmd/gd-simple/simple.go) doesn't work on my machine (macOS 11) – the process exits immediately – the pidfile exists for a few milliseconds and then is deleted. some info that might...
Follow the Signal handling to do a sample, my program needs a flag to control it into daemon mode or not. I add a new flag to control it. `dMode...
I noticed that the search function doesn't actually test whether a process is alive or not. According to the docs for `os.FindProcess(pid)` this will never be nil on Unix systems...
…the next call.
Hi, first of all, thank you so much for this wonderful project. Are you going to support plugable logging providers? I hope to use journald as the default logging, so...
ALL PRETTY GOOD on linux. ```shell $ uname -a Darwin shuhaideMacBook-Pro.local 16.5.0 Darwin Kernel Version 16.5.0: Fri Mar 3 16:52:33 PST 2017; root:xnu-3789.51.2~3/RELEASE_X86_64 x86_64 $ git log -n 1 commit...