add file logging support to systemd
This commit is contained in:
committed by
Daniel Theophanes
parent
3bfa85e2d7
commit
994866c14a
@@ -82,11 +82,13 @@ func (s *systemd) Install() error {
|
|||||||
Path string
|
Path string
|
||||||
ReloadSignal string
|
ReloadSignal string
|
||||||
PIDFile string
|
PIDFile string
|
||||||
|
LogOutput bool
|
||||||
}{
|
}{
|
||||||
s.Config,
|
s.Config,
|
||||||
path,
|
path,
|
||||||
s.Option.string(optionReloadSignal, ""),
|
s.Option.string(optionReloadSignal, ""),
|
||||||
s.Option.string(optionPIDFile, ""),
|
s.Option.string(optionPIDFile, ""),
|
||||||
|
s.Option.bool(optionLogOutput, optionLogOutputDefault),
|
||||||
}
|
}
|
||||||
|
|
||||||
err = s.template().Execute(f, to)
|
err = s.template().Execute(f, to)
|
||||||
@@ -166,6 +168,8 @@ ExecStart={{.Path|cmdEscape}}{{range .Arguments}} {{.|cmd}}{{end}}
|
|||||||
{{if .UserName}}User={{.UserName}}{{end}}
|
{{if .UserName}}User={{.UserName}}{{end}}
|
||||||
{{if .ReloadSignal}}ExecReload=/bin/kill -{{.ReloadSignal}} "$MAINPID"{{end}}
|
{{if .ReloadSignal}}ExecReload=/bin/kill -{{.ReloadSignal}} "$MAINPID"{{end}}
|
||||||
{{if .PIDFile}}PIDFile={{.PIDFile|cmd}}{{end}}
|
{{if .PIDFile}}PIDFile={{.PIDFile|cmd}}{{end}}
|
||||||
|
{{if .LogOutput}}StandardOutput=file:/var/log/{{.Name}}.out"
|
||||||
|
StandardError=file:/var/log/{{.Name}}.err{{end}}
|
||||||
Restart=always
|
Restart=always
|
||||||
RestartSec=120
|
RestartSec=120
|
||||||
EnvironmentFile=-/etc/sysconfig/{{.Name}}
|
EnvironmentFile=-/etc/sysconfig/{{.Name}}
|
||||||
|
|||||||
Reference in New Issue
Block a user