I am wondering why during service start up environment variables are not visible. To be more precise: I created service startup scrip according to LSB spec which starts some java process. For this purpose JAVA_HOME env variable is checked first. This env variable is set in /etc/profile.d/java.sh. That is probably not executed while starting the service. I would like uderstand the process and what is the correct solution in such case?

  • What about to install tomcat and use that script as reference? – jirib Oct 24 '13 at 11:36

RC scripts are invoked as non-interactive shell scripts. Thus they do not read /etc/profile. Thus you have to explicitly define your variables in your script. Either directly in your script or use some (covering up) techniques lot of RC script use (main variables defined in /etc/sysconfig/$package).

See how tomcat6 is doing that (although it is quite overcomplicated according to my opinion).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.