-1

I have a linuxOS based system.i want to restart a executable bin file if it killed or crashed.

location of executable file in home/bin/filename i have etc directory where i init.d ,systemd,cron sun-directories are there.

please suggest any script to write so that if the bin file will be restarted if it srashes.

bkb
  • 11
  • 1
  • 3
  • What did you try? did you go through basic `bash` loop controls? Can we see some code that you have tried? – Inian Jan 11 '17 at 06:57
  • See: [How do I write a bash script to restart a process if it dies?](http://stackoverflow.com/q/696839/3776858) – Cyrus Jan 11 '17 at 07:21
  • Hi Inian , i didnt find any solution yet ,can you plz provides some bash script ,so i can try – bkb Jan 11 '17 at 07:39
  • @bkb: Refer the comments above for similar questions and use the accepted answer(the one with a tick mark) – Inian Jan 11 '17 at 07:44

1 Answers1

1

Try restartd package.

Restartd is a daemon for checking running and not running processes. It reads the /proc directory every n seconds and does a POSIX regexp on the process names. You can execute a script or a program if the process is or is not running.

You can set what process to watch, The interval, and etc.

Farhad Farahi
  • 35,528
  • 7
  • 73
  • 70