Provide custom log directory for posix (#311)
When running a service with posix, provide a custom path to the service output
This commit is contained in:
@@ -60,9 +60,8 @@ func (s *openrc) template() *template.Template {
|
||||
|
||||
if customScript != "" {
|
||||
return template.Must(template.New("").Funcs(tf).Parse(customScript))
|
||||
} else {
|
||||
return template.Must(template.New("").Funcs(tf).Parse(openRCScript))
|
||||
}
|
||||
return template.Must(template.New("").Funcs(tf).Parse(openRCScript))
|
||||
}
|
||||
|
||||
func newOpenRCService(i Interface, platform string, c *Config) (Service, error) {
|
||||
@@ -113,10 +112,12 @@ func (s *openrc) Install() error {
|
||||
|
||||
var to = &struct {
|
||||
*Config
|
||||
Path string
|
||||
Path string
|
||||
LogDirectory string
|
||||
}{
|
||||
s.Config,
|
||||
path,
|
||||
s.Option.string(optionLogDirectory, defaultLogDirectory),
|
||||
}
|
||||
|
||||
err = s.template().Execute(f, to)
|
||||
@@ -227,7 +228,7 @@ command={{.Path|cmdEscape}}
|
||||
command_args="{{range .Arguments}}{{.}} {{end}}"
|
||||
{{- end }}
|
||||
name=$(basename $(readlink -f $command))
|
||||
supervise_daemon_args="--stdout /var/log/${name}.log --stderr /var/log/${name}.err"
|
||||
supervise_daemon_args="--stdout {{.LogDirectory}}/${name}.log --stderr {{.LogDirectory}}/${name}.err"
|
||||
|
||||
{{- if .Dependencies }}
|
||||
depend() {
|
||||
|
||||
Reference in New Issue
Block a user