LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-14-2009, 07:33 PM   #1
alirezan1
Member
 
Registered: Nov 2004
Location: Vancouver
Distribution: Ubunty, CentOS ,Mandriva, Gentoo, RedHat, Fedora, Knoppix
Posts: 150

Rep: Reputation: 15
how to run a bash script before startup


Hi guys,

I need to run a bash script at the startup before anything else is up. This file exports some important global variables for some other scripts that are supposed to come up after.

I tried rc.local but it doesn't work...after the command line is up, I can't execute the scripts because the configurations are not properly exported...
I don't want to use /etc/profile as it waits for bash to come up first before it can export the configs and I can't wait that long...

Any ideas?

Thanks
 
Old 01-14-2009, 08:45 PM   #2
yzhong
Member
 
Registered: Jun 2007
Location: sydney
Distribution: redhat , ubuntu, centos
Posts: 56

Rep: Reputation: 16
Did you try /etc/inittab or rc.sysinit?
(rc.local normally run after all the other init scripts)
 
Old 01-14-2009, 08:45 PM   #3
yzhong
Member
 
Registered: Jun 2007
Location: sydney
Distribution: redhat , ubuntu, centos
Posts: 56

Rep: Reputation: 16
...

Last edited by yzhong; 01-14-2009 at 08:49 PM.
 
Old 01-14-2009, 09:51 PM   #4
your_shadow03
Senior Member
 
Registered: Jun 2008
Location: Germany
Distribution: Slackware
Posts: 1,466
Blog Entries: 6

Rep: Reputation: 51
Put the script into the last line:

/etc/rc.d/rc.local
 
  


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
Bash Script Help - Trying to create a variable inside script when run. webaccounts Linux - Newbie 1 06-09-2008 02:40 PM
Running a bash script at startup linker3000 Linux - Software 2 05-17-2007 10:00 PM
'cannot stat' script in /etc/rc.d/, try to run script at startup quintan Linux - Software 1 11-21-2005 02:53 AM
where is bash startup script? gvaught Linux - Newbie 6 12-21-2003 05:10 AM
How to run script on startup Angelis Linux - General 1 11-16-2003 05:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:34 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