2

I created an init.d script that launches a system daemon. The daemon uses the system $PATH to launch other processes. The system path, however, does not include "/usr/local/bin" at the time the init.d loads the daemon. So, I have to stop/start the init.d daemon after reboot, which really defeats the purpose of the init.d script!

This question says the init.d script should set the path. PATH issues for init.d scripts on startup

Although this is possible, I'd like a little more flexibility. Is it possible to force the init.d script to load at a runlevel after the system sets the $PATH variable?

1
  • 1
    Why not update PATH in your script to include /usr/local/bin ? e.g. export PATH=$PATH:/usr/local/bin Nov 8, 2014 at 12:00

1 Answer 1

1

It's not that the path is changed during init, rather it's that normal shells get a different environment. See http://www.tldp.org/HOWTO/Path-4.html for an explanation.

Either set the path explicitly at the top of your script or create a new script to set the path and source that at the top of scripts that need the changed environment.

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.