LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 06-03-2004, 04:47 PM   #1
mehesque
Member
 
Registered: Oct 2003
Location: TX
Distribution: RH 8.0
Posts: 97

Rep: Reputation: 15
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.
 
Old 06-03-2004, 04:50 PM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 65
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
 
Old 06-03-2004, 04:53 PM   #3
mehesque
Member
 
Registered: Oct 2003
Location: TX
Distribution: RH 8.0
Posts: 97

Original Poster
Rep: Reputation: 15
My mistake that would be /etc/rc.local.
 
Old 06-03-2004, 04:55 PM   #4
mehesque
Member
 
Registered: Oct 2003
Location: TX
Distribution: RH 8.0
Posts: 97

Original Poster
Rep: Reputation: 15
I forgot to mention that I want to do this at run level 5.
 
Old 06-03-2004, 04:59 PM   #5
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 65
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.
 
Old 06-03-2004, 05:26 PM   #6
mehesque
Member
 
Registered: Oct 2003
Location: TX
Distribution: RH 8.0
Posts: 97

Original Poster
Rep: Reputation: 15
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?
 
Old 06-07-2004, 02:41 PM   #7
mehesque
Member
 
Registered: Oct 2003
Location: TX
Distribution: RH 8.0
Posts: 97

Original Poster
Rep: Reputation: 15
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.
 
Old 06-08-2004, 12:07 PM   #8
mehesque
Member
 
Registered: Oct 2003
Location: TX
Distribution: RH 8.0
Posts: 97

Original Poster
Rep: Reputation: 15
Any help would be very much appreciated, I'm getting a little desperate.

Thanks.
 
Old 06-08-2004, 01:23 PM   #9
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 65
I assume that you are booting to runlevel 5?
 
Old 06-08-2004, 02:34 PM   #10
mehesque
Member
 
Registered: Oct 2003
Location: TX
Distribution: RH 8.0
Posts: 97

Original Poster
Rep: Reputation: 15
Yes I am booting to runlevel 5, sorry about the delay.
 
Old 06-08-2004, 03:09 PM   #11
ssba
Member
 
Registered: Mar 2004
Distribution: Slackware 9.1
Posts: 44

Rep: Reputation: 15
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..
 
Old 06-08-2004, 03:37 PM   #12
mehesque
Member
 
Registered: Oct 2003
Location: TX
Distribution: RH 8.0
Posts: 97

Original Poster
Rep: Reputation: 15
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....
 
Old 06-08-2004, 05:07 PM   #13
ssba
Member
 
Registered: Mar 2004
Distribution: Slackware 9.1
Posts: 44

Rep: Reputation: 15
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
 
Old 06-09-2004, 10:41 AM   #14
mehesque
Member
 
Registered: Oct 2003
Location: TX
Distribution: RH 8.0
Posts: 97

Original Poster
Rep: Reputation: 15
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?
 
Old 06-09-2004, 12:38 PM   #15
ssba
Member
 
Registered: Mar 2004
Distribution: Slackware 9.1
Posts: 44

Rep: Reputation: 15
Quote:
Originally posted by mehesque
Hey ssba thanks for the ~/.xinitrc suggestion I think that's the right direction. However, for some reason that isn't working.
It shouldn't effect anything, I'm pretty sure gnome uses .xinitrc as well. Does the file have executable permissions? Usually its 700 or 755.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Running programs as root via launcher? Fenster Fedora 3 10-06-2004 04:06 PM
running programs from root oscarp Linux - Software 2 09-17-2004 09:08 AM
running programs as root marsques Linux - Newbie 5 08-15-2004 02:18 PM
Running programs as root from launcher Myrkul23 Linux - General 3 07-19-2004 10:26 PM
Fluxbox and Running Programs as Root jrdioko Linux - Newbie 5 06-14-2003 08:20 PM


All times are GMT -5. The time now is 01:51 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration