diff --git a/go-daemon/godaemon1.go b/go-daemon/godaemon1.go index a3abc48..d738e3b 100644 --- a/go-daemon/godaemon1.go +++ b/go-daemon/godaemon1.go @@ -9,11 +9,11 @@ import ( func main() { cntxt := &daemon.Context{ - PidFileName: "/var/godaemon1.pid", + PidFileName: "godaemon1.pid", PidFilePerm: 0644, - LogFileName: "/var/log/godaemon1.log", + LogFileName: "godaemon1.log", LogFilePerm: 0640, - WorkDir: "./", + WorkDir: "/etc/godaemon1/", Umask: 027, // Args: []string{"[go-daemon godaemon1]"}, } diff --git a/go-daemon/godaemon1.service b/go-daemon/godaemon1.service index c321bd3..59b8a83 100644 --- a/go-daemon/godaemon1.service +++ b/go-daemon/godaemon1.service @@ -7,7 +7,7 @@ Type=forking User=root Group=root ExecStart=/usr/bin/godaemon1 -PIDFile=/run/godaemon1.pid +PIDFile=/etc/godaemon/godaemon1.pid PrivateTmp=false Restart=always diff --git a/go-daemon/install.sh b/go-daemon/install.sh index b038148..fdc414a 100644 --- a/go-daemon/install.sh +++ b/go-daemon/install.sh @@ -15,6 +15,7 @@ go build -o ./bin/ # Installing sudo mv ./bin/godaemon1 /usr/bin/godaemon1 +sudo mkdir -p /etc/godaemon1/ if [ $(ps -jp 1 | awk 'FNR == 2 {print $6}') == "systemd" ] then sudo mv ./godaemon1.service /etc/systemd/system/