How can i run shell script every time my system boot ( start up ) in linux (RHEL 5)?

link|improve this question

feedback

2 Answers

up vote 3 down vote accepted

echo /path/to/script.sh >> /etc/rc.local

link|improve this answer
feedback

As dyasny said, you can add the script call to your /etc/rc.local.

Another (cleaner) way would be to write an init script for it, place it in /etc/init.d/yourservice and add rc links to it (I don't remember which command does that on RHEL5) so that it gets started in the right position during boot and stopped during halt (if necessary).

link|improve this answer
the command is chkconfig I guess :) – dyasny Feb 3 '10 at 10:10
Yep thanks. I'm more of a update-rc.d guy ;-) – Raphink Feb 3 '10 at 11:18
But update-rc.d doesn't accept arbitrary scripts. They have to be "LSB-compliant" or whatever. – user38334 Oct 10 '11 at 21:27
@user38334: You wish, really... – Raphink Oct 11 '11 at 8:23
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.