add file logging support to systemd

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