LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-21-2007, 09:15 PM   #1
natm
Member
 
Registered: Sep 2004
Distribution: Ubuntu 7.04
Posts: 34

Rep: Reputation: 15
Where is the startup script located?


I know I can go to settings and have something start with gnome, but where is the actual startup script? I want to have programs run as soon as the computer boots up, graphical interface or no.
 
Old 09-21-2007, 09:37 PM   #2
blackhole54
Senior Member
 
Registered: Mar 2006
Posts: 1,896

Rep: Reputation: 61
That depends somewhat on the distro. Many distros have a file called rc.local which will be the last last script to execute on boot. Ubuntu places this script in /etc while I believe RH/Fedora put this in /etc/rc.d.

Try running: locate "rc.local"

Realize that anything executed from this script will execute as root. If you want the command to execute as a different user, us su.

You will probably also want to end each line with a "&" so the script doesn't wait for the command to finish before proceeding. If you are wanting to run a daemon, you might want to do some research on the proper way to do that.
 
Old 09-21-2007, 10:42 PM   #3
natm
Member
 
Registered: Sep 2004
Distribution: Ubuntu 7.04
Posts: 34

Original Poster
Rep: Reputation: 15
well, there's /etc/rc.local, I'd assume that that is it, but your comment about using su confused me. could you elaborate?

I thought that su made it so you were the superuser, instead of taking root privileges away from you.
 
Old 09-22-2007, 12:30 AM   #4
blackhole54
Senior Member
 
Registered: Mar 2006
Posts: 1,896

Rep: Reputation: 61
Quote:
Originally Posted by natm View Post
well, there's /etc/rc.local, I'd assume that that is it, but your comment about using su confused me. could you elaborate?

I thought that su made it so you were the superuser, instead of taking root privileges away from you.
Yes, /etc/rc.local is the file. On my first post I had neglected to notice that you list Ubuntu as your distro.

su is frequently used to acquire superuser privileges, but it can, in fact, make you any user. When a user is not specified, su defaults to root, and you will usually have to supply root's password. If you are already root, then you can become, or execute commands as any user w/o specifying a password. For example, here is a line from one of the scripts in my /etc/cron.daily directory.

Code:
[ -x $arch_script ] && su -c "nice -2 $arch_script" jim
The variable arch_script has been set to a script I want to run daily as user "jim". Everything in this directory will be run once a day as the superuser. So this line first tests and makes sure $arch_script exists and is executable, (although it doesn't actually test to make sure it is executable by jim ). If so, then it executes the script with a "niceness" of 2 as user "jim".
 
Old 09-22-2007, 12:32 AM   #5
natm
Member
 
Registered: Sep 2004
Distribution: Ubuntu 7.04
Posts: 34

Original Poster
Rep: Reputation: 15
ok, thanks, I should be able to get it to work now, and sorry, I thought I posted that I was running ubuntu, but I guess I didn't. Thanks for being observant
 
Old 09-22-2007, 01:56 AM   #6
frenchn00b
Senior Member
 
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,561

Rep: Reputation: 57
I place my script in /etc/rc2.d/S99lmjmldjfqsd
chmod +x this script made then
and 99 means when it ll be started
rc2.d is at boot
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
'cannot stat' script in /etc/rc.d/, try to run script at startup quintan Linux - Software 1 11-21-2005 02:53 AM
How to call a script from a system startup script? jonatito Linux - Newbie 7 11-11-2005 09:40 PM
startup script waelaltaqi Linux - Software 3 10-01-2005 07:44 PM
startup script? ilnli Slackware 14 01-03-2005 12:07 PM
What's a startup script? rdaves@earthlink.net Linux - Newbie 1 05-22-2001 03:24 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:11 AM.

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
Open Source Consulting | Domain Registration