What is loaded after rc.local? [RESOLVED]

aceO07

Diamond Member
Nov 6, 2000
4,491
0
76
I have a web server start up in rc.local, but it doesn't seem to work properly. If I logon the system and start it up as root, the server does work.

The only thing that doesn't work is a call to ImageMagick, which I do have installed. Starting the web server from rc.local seems to load properly, but the imagemagick stuff doesn't work. Starting manually as root, it does work.

Anybody have any idea what could be different? From what I can tell, the rc.local also starts the web server as root too, so that's not the difference.

SOLUTION: Updated PATH in rc.local to include all directories that would be included after logging in.
 

Crusty

Lifer
Sep 30, 2001
12,684
2
81
Does the user that starts the script have their PATH set so they can see the imagemagick binaries?
 

aceO07

Diamond Member
Nov 6, 2000
4,491
0
76
Originally posted by: Crusty
Does the user that starts the script have their PATH set so they can see the imagemagick binaries?

You mean rc.local? I don't know if the PATH is set before or after that. However, I put in the server start command at the end of rc.local. I did put in the full path to the imagemagick application when I call it from my web server.
 

aceO07

Diamond Member
Nov 6, 2000
4,491
0
76
Thanks Crusty, you gave me the right idea. I had my app output the $PATH and it didn't include all the directories. I wrongly assumed the rc.local would be the last step linux runs. I manually updated the PATH in rc.local and everything works now. The biggest hurdle was that the server's system call never gave me any output or maybe it was the imagemagick application that didn't provide output.
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
I wrongly assumed the rc.local would be the last step linux runs.

It depends on the distro's init scripts but generally rc.local is the last step. The thing is that init's environment is going to be different from a user's interactive shell's environment so it's best to use full path's or setup the environment however you need it at the beginning of the script.