LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
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, 08:33 PM   #1
alirezan1
Member
 
Registered: Nov 2004
Location: Vancouver
Distribution: Ubunty, CentOS ,Mandriva, Gentoo, RedHat, Fedora, Knoppix
Posts: 147

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, 09: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, 09: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 09:49 PM.
 
Old 01-14-2009, 10:51 PM   #4
your_shadow03
Senior Member
 
Registered: Jun 2008
Location: Germany
Distribution: Slackware
Posts: 1,443
Blog Entries: 6

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

/etc/rc.d/rc.local
 
  


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


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