Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

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

share|improve this answer
add comment

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).

share|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 ;-) –  ℝaphink 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... –  ℝaphink Oct 11 '11 at 8:23
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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