I want to monitor a couple of services in linux. In case they go down I want to restart them.
I'm writing a crontab which will get the name of the services using jps command every 60 seconds, and if they're not present in the resultset, issue a restart command specific to each of these services.
I want these services to be always available so in case they go down I'm able to get them up and running again.
I'm worried that in case any of these services hang up how will I know. Is there a way to know about hung services and kill them?
Is there a clean way of implementing auto restart of services which will handle both "services that go down" and "services that hang up".