Skip to main content
Topic: [Solved][Dinit]env-file not working (Read 497 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

[Solved][Dinit]env-file not working

Hi , I wanted to try env-file property of dinit service
I create /etc/dinit.d/hello
Code: [Select]
#cat /etc/dinit.d/hello
type = scripted
command = echo $VAR
env-file = /etc/dinit.d/config/hello.cfg
logfile = /tmp/hello.log

also created /etc/dinit.d/config/hello.cfg
Code: [Select]
VAR="Hi"

but I dont see variable substitution in log file.

Am I doing wrong?
If possible provide some example for env-file usage
Create problems which don't have solution

Re: [Dinit]env-file not working

Reply #1
The values from the file specified by env-file aren't used for command line variable substitution. From "man dinit-service":

       env-file = file
              Specifies a file containing value assignments for environment
              variables, in the same format recognised by the dinit command's
              --env-file option.  The file is read (or re-read) whenever the
              service is started; the values read do not affect for the
              processing performed for the sub-vars load option, which is done
              when the service description is loaded.


This behaviour might change in a future version of Dinit.

(also you would currently need "load-options = sub-vars" to substitute environment variables regardless)