Restart a service automatically
Hi all
I wanna know, is there a way to restart a service automatically when sth killed it's related process? E.G, consider that I wanna have my vsftpd always running, and if something stopped it, Linux start it again automatically. |
Your best bet is to run a script that checks for the processes and put it in the crontab to run and check every few minutes (depending on the needs).
I'm thinking somewhere like "ps -e" and testing whether the service is active. If you use Fedora, you can also use /sbin/service <servicename> status to show the status of the service. There are different ways to do this, but I can't write the script for you right now, sorry. But I'm sure there are plenty of guys here who can ^^ |
If the service is controlled by xinetd, then another instance is started each time a new connection if made. Check how vsftp is run.
It may be started normally in runlevels 3 and 5 but have an /etc/xinetd.d/vsftpd configuration file as well. If so, you could run "sudo /sbin/chkconfig vsftpd off" and then "sudo /sbin/chkconfig vsftpd xinetd". The second entry will simply delete the "disable = yes" line which you could do yourself. Code:
# default: off |
All times are GMT -5. The time now is 04:22 PM. |