use go-daemon library

This commit is contained in:
Aliberk Sandıkçı 2023-07-29 13:11:02 +03:00
parent 8fd2cd77cf
commit 56fc88c9fc
Signed by: asandikci
GPG key ID: 25C67A03B5666BC1

View file

@ -1,33 +1,34 @@
package main package main
import ( import (
// "log" "log"
"time" "time"
// "github.com/sevlyar/go-daemon"
"github.com/sevlyar/go-daemon"
) )
func main() { func main() {
// cntxt := &daemon.Context{ cntxt := &daemon.Context{
// PidFileName: "godaemon1.pid", PidFileName: "godaemon1.pid",
// PidFilePerm: 0644, PidFilePerm: 0644,
// LogFileName: "godaemon1.log", LogFileName: "godaemon1.log",
// LogFilePerm: 0640, LogFilePerm: 0640,
// WorkDir: "./", WorkDir: "./",
// Umask: 027, Umask: 027,
// Args: []string{"[go-daemon godaemon1]"}, Args: []string{"[go-daemon godaemon1]"},
// } }
// d, err := cntxt.Reborn() d, err := cntxt.Reborn()
// if err != nil { if err != nil {
// log.Fatal("Unable to run: ", err) log.Fatal("Unable to run: ", err)
// } }
// if d != nil { if d != nil {
// return return
// } }
// defer cntxt.Release() defer cntxt.Release()
//
// log.Print("- - - - - - - - - - - - - - -") log.Print("- - - - - - - - - - - - - - -")
// log.Print("daemon started") log.Print("daemon started")
for true { for true {
Info() Info()