So I am relatively new to Centos, version 6.2. I have a service that needs to be mnonitored as a cron job, and if it stops needs to be restarted. I have a few ideas on how to monitor it, but when it comes to getting it restarted thats when I get stuck. I also know the PiD of the service I want to monitor.
Asked
Active
Viewed 142 times
-1
-
Since Stack Overflow hides the Close reason from you: *Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: [How to create a Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve).* – jww Apr 21 '18 at 00:20
1 Answers
0
You can use supervise
for this: http://cr.yp.to/daemontools/supervise.html
Put it in your crontab to launch on system start:
@reboot supervise foo

John Zwinck
- 239,568
- 38
- 324
- 436
-
Sorry I suppose I should have clarified. I am required to only do it through bash scripting. So no convenient or easy to use tools, otherwise I would be using daemon tools – Dr.Bradley Apr 20 '18 at 14:32
-
Well then it's time to start writing code. We won't do it for you. – John Zwinck Apr 21 '18 at 00:36