Commit 44519877 by Bogdan Ungureanu

Updating daemon lib

parent 1e05a169
......@@ -134,6 +134,11 @@ func (d *Daemon) getPid() int {
// Write pid to file
func (d *Daemon) setPid() error {
if os.Getenv("go-daemon-child") == "" {
return nil
}
pidfile, err := os.OpenFile(
d.PidFile,
os.O_CREATE|os.O_RDWR,
......@@ -204,5 +209,12 @@ func (d *Daemon) startProcess() error {
}
func (d *Daemon) stopProcess() error {
pid := d.getPid()
if pid > 0 {
err := syscall.Kill(pid, syscall.SIGINT)
if err != nil {
return nil
}
}
return nil
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment