running programs as root
I'm using RH AS 3.0 at the moment. My intention is to automate a testing process. For this I'll need to automate the logon process and the kickoff of a few scripts.
I guess I have three questions. 1) I'm able to automatically logon as a standard user using one of RH's options but is there a way to logon automatically as root? I won't have to logon as root if #2 can be answered, but I would rather do it this way. 2) I have some proprietary programs that only run under root. I tried using the sticky bit on these but I guess that I don't understand that concept properly as they still won't run. 3) If i wanted to cascade a few scripts--after one finishes, the next one can go. Do I just list them in the /init/rc.d/local directory or is there a cleaner way? Thanks a lot. |
1) If I assume that you are running these at boot since you ask about rc directories in 3 - then the scripts will run as root by default.
3) If you want them to run at boot then rc.local should be fine. If you want to make sure that command1 exists successfully before running command2 then you can use: command1 && command2 |
My mistake that would be /etc/rc.local.
|
I forgot to mention that I want to do this at run level 5.
|
If you only want to do it at runlevel 5 then don't use rc.local. Create a new script in init.d and symlink it as a startup script to the runlevel 5 folder.
|
Thanks for the info and the quick responce.
However, I don't think it ran for some reason. I also noticed a "INIT: open(/dev/console): Input/output error" during bootup. Is this out of the norm? |
I've tried put a script in the init.d directory with a S99 sysmlink in rc5.d. I'm not sure if that's the way to do it--besides the fact it's not working for me.
What I'm trying to kick off isn't a daemon, it's simple a stand-alone program. I just want it to automatically input a shell command with a few options and switches and it run on boot up as root. Thanks for the quick response last time. |
Any help would be very much appreciated, I'm getting a little desperate.
Thanks. |
I assume that you are booting to runlevel 5?
|
Yes I am booting to runlevel 5, sorry about the delay.
|
As for #2, you can try running the programs under sudo (man sudo), which basically runs programs with root privileges while under a normal user..
|
Basically I don't think the issue is root, I think it's about how do I run a command from rc5.d in runlevel 5. The init script doesn't have a fully functional daemon.
I just want to run some commands once everything is up and running. Much like running a batch file placed in the startup folder in Windows.... |
well, if you want the programs to start when your computer is finished booting (before X / GUI), you can *usually* add them (each on a separate line) to /etc/rc.d/rc.local (or wherever your version of that is located at -- theres usually a file like that where you can put in your commands, i'm not sure where that is exactly in RH. /etc/init.d/rc.d/rc.local maybe? )
Or, if you want them to start when your X / GUI loads, you can add them, one command per line, to ~/.xinitrc |
Hey ssba thanks for the ~/.xinitrc suggestion I think that's the right direction. However, for some reason that isn't working.
I've sudo-ed all the programs so that that isn't my concern. I've tried the command by itself, I've tried it appened on the end of the copied /etc/X11/xinit/xinitrc. I'm using gdm(rh9.0) though, so should that affect anything? |
Quote:
|
All times are GMT -5. The time now is 01:35 PM. |