LinuxQuestions.org
Visit Jeremy's Blog.
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 07-14-2003, 04:17 PM   #1
jhayes
Member
 
Registered: Jul 2003
Posts: 33

Rep: Reputation: 15
Boot Script


hello i have a script i want to start when the server boots. i put the script on the /etc/rc.d/rc.local is this the right place? for some reason it doesn't run the script at boot.

any ideas,

i am running linux red hat 8.0


thanks,

jh
 
Old 07-14-2003, 04:31 PM   #2
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
That is usually the file to place them in but I believe it depends on what runlevel you startup in, as Redhat changes these around, could be in /etc/rc.d/init.d or so forth. I no longer use Redhat, but sometimes they will have a link to each runlevel in /etc/ named like rc.0 or rc.3 and so forth. If you boot into runlevel 3, place the script where the link /etc/rc.3 is linked to.
 
Old 07-14-2003, 04:32 PM   #3
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
/etc/rc.d/rc.local is a good place. But if it's a script, it may be better to put it to /etc/rc.d/init.d/ and symplnk it to the right runlevel (for example /etc/init.d/rc3.d/S50yourservice). 'rc3.d' means it's runlevel 3 (console, multiuser, with network), 'S50' means to start the service (S), numbers are priorities.
 
Old 07-14-2003, 04:35 PM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
...and if you're still wondering why it didn't work while you had in incorporated in rc.local, debugging shouldn't be hard if you make it a separate script and do "sh -x <script> (args) 2>&1|tee /tmp/script.log", then read /tmp/script.log if it did fly by to fast.
Else post the script(+log).
 
Old 07-14-2003, 04:39 PM   #5
jhayes
Member
 
Registered: Jul 2003
Posts: 33

Original Poster
Rep: Reputation: 15
/etc/rc.d/rc.local is a good place. But if it's a script, it may be better to put it to /etc/rc.d/init.d/ and symplnk it to the right runlevel (for example /etc/init.d/rc3.d/S50yourservice). 'rc3.d' means it's runlevel 3 (console, multiuser, with network), 'S50' means to start the service (S), numbers are priorities.

sorry kind of a newbie,
i have the script called startup.sh , how would i add this to the /etc/initd/rc3.d/ ?

thanks
 
Old 07-14-2003, 04:43 PM   #6
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
/etc/rc.d/init.d/ directory, simply copy your script inside. Then you need to create a symplnik from this file (copied). The symplink should be placed in the right directory /etc/rc?.d/
 
Old 07-14-2003, 04:59 PM   #7
jhayes
Member
 
Registered: Jul 2003
Posts: 33

Original Poster
Rep: Reputation: 15
okay i copied the script to the folder /etc/rc.d/init.d,

how do i create the symplnik though? once created do i put it in /etc/rc3.d?

thanks, and sorry for the questions.
 
Old 07-14-2003, 05:15 PM   #8
angelrod
Member
 
Registered: Oct 2002
Location: Mexico
Distribution: RedHat 9.0 and SuSE 8.1
Posts: 229

Rep: Reputation: 30
Just:

ln -s /etc/rc.d/init.d/startup.sh /etc/rc.d/rc3.d/S50startup
 
Old 07-14-2003, 05:22 PM   #9
jhayes
Member
 
Registered: Jul 2003
Posts: 33

Original Poster
Rep: Reputation: 15
COOL I'LL GIVE THIS A TRY AND LET YOU GUYS KNOW HOW IT WORKS.
 
Old 07-15-2003, 09:43 AM   #10
jhayes
Member
 
Registered: Jul 2003
Posts: 33

Original Poster
Rep: Reputation: 15
no luck, it didn't start. i had to run the script manually. is there a was to test it, without having to reboot? does anyone know how i can troubleshoot this?

thanks,
 
Old 07-15-2003, 10:15 AM   #11
angelrod
Member
 
Registered: Oct 2002
Location: Mexico
Distribution: RedHat 9.0 and SuSE 8.1
Posts: 229

Rep: Reputation: 30
On which level are you booting??
 
Old 07-15-2003, 10:18 AM   #12
jhayes
Member
 
Registered: Jul 2003
Posts: 33

Original Poster
Rep: Reputation: 15
rc3.d
 
Old 07-15-2003, 10:44 AM   #13
angelrod
Member
 
Registered: Oct 2002
Location: Mexico
Distribution: RedHat 9.0 and SuSE 8.1
Posts: 229

Rep: Reputation: 30
Quote:
Originally posted by angelrod
Just:

ln -s /etc/rc.d/init.d/startup.sh /etc/rc.d/rc3.d/S50startup
You know, it was my mistake. The rigth path is:

ln -s /etc/rc.d/init.d/startup.sh /etc/rc3.d/S50startup
 
Old 07-15-2003, 11:08 AM   #14
jhayes
Member
 
Registered: Jul 2003
Posts: 33

Original Poster
Rep: Reputation: 15
somehow it got created in the /etc/rc3.d/ directory. because i have it in both the /etc/rc.d/rc3.d and in /etc/rc3.d. and i did a diff on both and there is no differences.

any ideas,

thanks
 
Old 07-15-2003, 02:35 PM   #15
angelrod
Member
 
Registered: Oct 2002
Location: Mexico
Distribution: RedHat 9.0 and SuSE 8.1
Posts: 229

Rep: Reputation: 30
Yes, it was created in both folders because the /etc/rcX.d are symbolic links to the real ones /etc/rc.d/rcX.d

It's weird that the script doesn't execute when booting in text mode (level 3).

If you go to /etc/rc.d/init.d and you try to execute the script like:

./startup.sh

Does it executes normally??
 
  


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
boot script? tzonga1 Fedora 1 11-13-2004 04:36 PM
boot script freaker2k5 Mandriva 3 08-29-2004 02:44 PM
Boot Script justaguynsrq Linux - Newbie 5 03-18-2004 11:05 AM
Stop boot script at boot time!! kmiles2 Linux - Newbie 1 02-23-2004 10:04 PM
Script at boot Half_Elf Programming 3 06-02-2002 10:13 AM

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

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