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() {
|
func main() {
|
||||||
cntxt := &daemon.Context{
|
cntxt := &daemon.Context{
|
||||||
PidFileName: "/var/godaemon1.pid",
|
PidFileName: "godaemon1.pid",
|
||||||
PidFilePerm: 0644,
|
PidFilePerm: 0644,
|
||||||
LogFileName: "/var/log/godaemon1.log",
|
LogFileName: "godaemon1.log",
|
||||||
LogFilePerm: 0640,
|
LogFilePerm: 0640,
|
||||||
WorkDir: "./",
|
WorkDir: "/etc/godaemon1/",
|
||||||
Umask: 027,
|
Umask: 027,
|
||||||
// Args: []string{"[go-daemon godaemon1]"},
|
// Args: []string{"[go-daemon godaemon1]"},
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ Type=forking
|
||||||
User=root
|
User=root
|
||||||
Group=root
|
Group=root
|
||||||
ExecStart=/usr/bin/godaemon1
|
ExecStart=/usr/bin/godaemon1
|
||||||
PIDFile=/run/godaemon1.pid
|
PIDFile=/etc/godaemon/godaemon1.pid
|
||||||
|
|
||||||
PrivateTmp=false
|
PrivateTmp=false
|
||||||
Restart=always
|
Restart=always
|
||||||
|
|
|
@ -15,6 +15,7 @@ go build -o ./bin/
|
||||||
|
|
||||||
# Installing
|
# Installing
|
||||||
sudo mv ./bin/godaemon1 /usr/bin/godaemon1
|
sudo mv ./bin/godaemon1 /usr/bin/godaemon1
|
||||||
|
sudo mkdir -p /etc/godaemon1/
|
||||||
if [ $(ps -jp 1 | awk 'FNR == 2 {print $6}') == "systemd" ]
|
if [ $(ps -jp 1 | awk 'FNR == 2 {print $6}') == "systemd" ]
|
||||||
then
|
then
|
||||||
sudo mv ./godaemon1.service /etc/systemd/system/
|
sudo mv ./godaemon1.service /etc/systemd/system/
|
||||||
|
|
Loading…
Reference in a new issue