An interviewer asked me this question in an interview.
He asked, suppose a service xyz stops due to any reason and you want it running all the time, what will you do so that it will start automatically
An interviewer asked me this question in an interview.
He asked, suppose a service xyz stops due to any reason and you want it running all the time, what will you do so that it will start automatically
I don't want to be mean but a simple google search will give you a lot of options to do this. Here is one I found:
The easiest way would be to add it to /etc/inittab, which is designed to do this sort of thing:
respawn If the process does not exist, start the process. Do not wait for its termination (continue scanning the /etc/inittab file). Restart the process when it dies. If the process exists, do nothing and continue scanning the /etc/inittab file.
For example, you could do this:
# Run my stuff
myprocess:2345:respawn:/bin/myprocess
Link: How to automatically restart a linux background process if it fails?