update working directory and pid file location
This commit is contained in:
parent
59bf79feee
commit
f75ff864f3
3 changed files with 5 additions and 4 deletions
|
@ -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]"},
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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/
|
||||
|
|
Loading…
Reference in a new issue