LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   Reboot init script doesn't work (http://www.linuxquestions.org/questions/linux-software-2/reboot-init-script-doesnt-work-150474/)

casey0999 02-25-2004 04:28 PM

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!

bnice 02-25-2004 05:00 PM

can you call it from the command line & have it execute?

casey0999 02-25-2004 05:06 PM

Yes - I tested that it is executable from the command line, and also that its permissions include "execute"

tk31337 02-25-2004 05:06 PM

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.

casey0999 02-25-2004 05:12 PM

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

jailbait 02-25-2004 05:13 PM

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

casey0999 02-25-2004 05:15 PM

Ok, I will try that. I've gone home now, so I'll do it tomorrow.

Thanks


All times are GMT -5. The time now is 10:43 AM.