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:
@@ -58,9 +58,8 @@ func (s *sysv) template() *template.Template {
|
||||
|
||||
if customScript != "" {
|
||||
return template.Must(template.New("").Funcs(tf).Parse(customScript))
|
||||
} else {
|
||||
return template.Must(template.New("").Funcs(tf).Parse(sysvScript))
|
||||
}
|
||||
return template.Must(template.New("").Funcs(tf).Parse(sysvScript))
|
||||
}
|
||||
|
||||
func (s *sysv) Install() error {
|
||||
@@ -86,10 +85,12 @@ func (s *sysv) 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)
|
||||
@@ -203,8 +204,8 @@ cmd="{{.Path}}{{range .Arguments}} {{.|cmd}}{{end}}"
|
||||
|
||||
name=$(basename $(readlink -f $0))
|
||||
pid_file="/var/run/$name.pid"
|
||||
stdout_log="/var/log/$name.log"
|
||||
stderr_log="/var/log/$name.err"
|
||||
stdout_log="{{.LogDirectory}}/$name.log"
|
||||
stderr_log="{{.LogDirectory}}/$name.err"
|
||||
|
||||
[ -e /etc/sysconfig/$name ] && . /etc/sysconfig/$name
|
||||
|
||||
|
||||
Reference in New Issue
Block a user