update working directory and pid file location

This commit is contained in:
Aliberk Sandıkçı 2023-07-29 13:38:17 +03:00
parent 59bf79feee
commit f75ff864f3
Signed by: asandikci
GPG Key ID: 25C67A03B5666BC1
3 changed files with 5 additions and 4 deletions

View File

@ -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]"},
}

View File

@ -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

View File

@ -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/