Trying to run commands at boot Centos 5
I am running Centos 5 and am moving from an all windows server running open source software, to running Centos 5 with all of my software. My problem is i need to run some commands at boot, such as starting hamachi and starting a vnc user. I did try to use rc scripts, and i did get it to work.....kinda. When i boot it says bad command line interpreter. Is this an easier way to do this? RC scripts do seem to be more "getting into the guts of things", so if i could do it that way that would be great. Thank you.
|
How about /etc/rc.local?
This, as the file will tell you, will execute commands after the normal rc.? startup services |
The simple hack is to make a script, put all the commandline stuff in there which works when you type it into the console, make it executable, and add the path to the script to the bottom of /etc/rc.local
It will run at login. IIRC: CentOS also has a GUI for running programs at startup. |
Ok that works great, except for 1 thing i need to run them as root. what would be the proper way of using su in this case.
|
I would have thought startups were as root, but you may need to test (try something like "touch /home/test.file") and when booted, do "ls -l /home" and see who the owner is.
If not, a potential dodge is to run from root's crontab with @reboot command |
AFAIK: startups run suid root.
Have you tried? |
Well i did find that the test file was created by root. So something else is wrong. What i am trying to do is run a tightVNC user and start hamachi. The vnc user starts but the display is all messed up, and hamachi gives me an error saying that a setup file is missing. But if i run all of these same exact commands after login as root everything works great. That my problem in a nutshell
|
I don't know either program, but it may help if you post the exact commands.
Note that there's a pretty good chance that environment variables aren't set in rc.local, so you may need to provide the full path for the command, specify where config files are, etc. |
vncserver :64 -geometry 1024x768 -depth 16 -name anauj
/sbin/tuncfg hamachi start hamachi go-online Now i found something wierd the vnc server works fine if i type it in manually but if i run the same exact command from a script the display is messed up. Hamachi requires one time initialization (per Linux user account). This step generates cryptographic key pair and creates ~/.hamachi directory where Hamachi stores the keys, the configuration and the state. To perform this initialization run ./hamachi-init This is what hamachi can not find when i run it from the rc.local. I have run this command, as i said earlier the hamachi commands do work if i run them after login as root. Hope that helps you. Also btw greatful for all the help. |
All times are GMT -5. The time now is 09:29 AM. |