StartupOptProgram How to Startup an /opt program from /etc/init.d
Back to HowTo
If you want to startup a program from
/opt with an init script, like
python, you have to modify the
PATH in order to make it work. In that phase of startup (runlevel 3) the
/opt/bin path is not yet included.
After the initial comments but before any executable lines, add a line
to your script except that you should replace the path I used above with whatever
is the correct path is on your system for the user who runs the init script
(probably root). From the command prompt as that user, type
echo $PATH and copy the output into the above
export ... statement.
You can verify the path by including in your script:
echo $PATH | logger and read it later with
logread (as root)
For beginners I want to mention, that you will place your script as an example in
/etc/init.d/moin.sh and make to it a symbolic link in
$ ln -s /etc/init.d/moin.sh /etc/rc3.d/S81moin
The actual runlevel can be checked with the command
runlevel. Usually it is 3 (
S80 means that it is a Start script, and the number means the place in a startup sequence from 0 to 99. Numbers could be duplicated.