inittab to auto restart script

Date February 2, 2009

Do you have a script/application that you want it running all the time, if it crashed then it auto restrart, auto launch on reboot ?, I have a php script that must run all the time, it do telnet to a port on another server and do some commands on that port… anyway i want this to be running all the time, i did it easily using respawn in inttab, this is the steps:

idlE ~ # vi /etc/inittab

at the end of the file add the following:

ax:2345:respawn:/root/scripts/sendSMS.sh

change /root/scripts/sendSMS.sh to your script/application path, then save and quit.

now you need to reread inittab file using the following command:

idlE ~ # init q

thats all, check the running process.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • StumbleUpon
  • Technorati
  • Reddit
  • Webnews
  • MisterWong
  • Y!GG

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>