Skip to content

Commit

Permalink
Add EnvVars to linux init.d (#339)
Browse files Browse the repository at this point in the history
* change module name

* add init.d env

* add init.d env
  • Loading branch information
optim-aizawa authored Oct 10, 2022
1 parent 380dcf8 commit 645b10f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions service_openrc_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down
4 changes: 4 additions & 0 deletions service_sysv_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 645b10f

Please sign in to comment.