diff --git a/service_openrc_linux.go b/service_openrc_linux.go index 72eaba4b..c678e3ae 100644 --- a/service_openrc_linux.go +++ b/service_openrc_linux.go @@ -230,6 +230,10 @@ command_args="{{range .Arguments}}{{.}} {{end}}" name=$(basename $(readlink -f $command)) supervise_daemon_args="--stdout {{.LogDirectory}}/${name}.log --stderr {{.LogDirectory}}/${name}.err" +{{range $k, $v := .EnvVars -}} +export {{$k}}={{$v}} +{{end -}} + {{- if .Dependencies }} depend() { {{- range $i, $dep := .Dependencies}} diff --git a/service_sysv_linux.go b/service_sysv_linux.go index 48650409..5a98a514 100644 --- a/service_sysv_linux.go +++ b/service_sysv_linux.go @@ -207,6 +207,10 @@ pid_file="/var/run/$name.pid" stdout_log="{{.LogDirectory}}/$name.log" stderr_log="{{.LogDirectory}}/$name.err" +{{range $k, $v := .EnvVars -}} +export {{$k}}={{$v}} +{{end -}} + [ -e /etc/sysconfig/$name ] && . /etc/sysconfig/$name get_pid() {