LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 02-25-2004, 04:28 PM   #1
casey0999
LQ Newbie
 
Registered: Jul 2003
Location: California & London
Posts: 15

Rep: Reputation: 0
Reboot init script doesn't work


Hello-
I'm having trouble getting a shell script to work that I want to call whenever the system is re-booted (init 6) or shutdown (init 0). I put the script in /etc/rc.d/init.d, make sure it is executable, and put a link to it in both /etc/rc.d/rc6.d and rc0.d. For now, to test, all the script does is print a line on the console using echo. I assign it a symbolic link name starting with "K" as required. The script is self-executing, ie: it starts with #!/bin/sh

What am I missing here?? (I'm running RedHat 9)

Thanks in advance for any help!
 
Old 02-25-2004, 05:00 PM   #2
bnice
Member
 
Registered: Feb 2004
Location: Sacramento, CA
Distribution: Slack 9.1, slackware-current
Posts: 284

Rep: Reputation: 30
can you call it from the command line & have it execute?
 
Old 02-25-2004, 05:06 PM   #3
casey0999
LQ Newbie
 
Registered: Jul 2003
Location: California & London
Posts: 15

Original Poster
Rep: Reputation: 0
Yes - I tested that it is executable from the command line, and also that its permissions include "execute"
 
Old 02-25-2004, 05:06 PM   #4
tk31337
Member
 
Registered: Oct 2003
Location: Tucson, AZ
Distribution: Linux Mint
Posts: 194

Rep: Reputation: 32
Might be helpfull if you posted the code, otherwise sounds like it should work. Also, try doublechecking that the script is actually being executed, by putting your code in an existing script that you know runs.
 
Old 02-25-2004, 05:12 PM   #5
casey0999
LQ Newbie
 
Registered: Jul 2003
Location: California & London
Posts: 15

Original Poster
Rep: Reputation: 0
Here it is (it's really simple, just to see if it executes):

#!/bin/sh

echo "Hi there - I'm here!"

exit 0

---------------------------------------------
I just wanted to see the Hi There line when I started an init 6. Instead, I got nothing. Just for fun, I inserted a similar echo statement into a script that I know is running from rc6.d, and it appeared nicely on the console after I typed init 6.
Thanks
 
Old 02-25-2004, 05:13 PM   #6
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,337

Rep: Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548
You could try making it an executable script called /sbin/halt.local. I think that is the file designated by Red Hat for use as a user shutdown script.

___________________________________
Be prepared. Create a LifeBoat CD.
http://users.rcn.com/srstites/LifeBo...home.page.html

Steve Stites
 
Old 02-25-2004, 05:15 PM   #7
casey0999
LQ Newbie
 
Registered: Jul 2003
Location: California & London
Posts: 15

Original Poster
Rep: Reputation: 0
Ok, I will try that. I've gone home now, so I'll do it tomorrow.

Thanks
 
  


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
No keyboard/mouse after reboot. Requires second reboot to work. rottie Linux - Hardware 6 01-16-2006 05:04 AM
Why won’t this init.d startup script work? dholingw Linux - Software 2 06-08-2004 02:40 PM
How to add something in init script Ypkis Linux - Newbie 5 10-12-2003 06:35 AM
could use some help with my init.d script.... BrianK Linux - General 3 10-31-2002 07:21 PM
control reboot, init 6 ,shutdown paulmccs Linux - General 3 02-27-2002 02:50 PM

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

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