3
rated 0 times
[
3]
[
0]
/ answers: 1 / hits: 2700
/ 3 Years ago, wed, july 21, 2021, 7:46:03
I need help crafting a crontable entry that will make sure the MongoDB service (daemon) is running on a particular port and if it is not, start it. I want to set this up so that if MongoDB crashes, it is automatically restarted. I'd like to have the check occur every five minutes. I have done this for other server processes but those services automatically exit if they find the port they want to bind to is already in use. My concern as a MongoDB newbie is that I'll end up starting yet another instance of MongoDB every five minutes instead of making sure only one instance is loaded. For example, here is my crontable entry for a chatbot service I keep running:
0,5,10,15,20,25,30,35,40,45,50,55 * * * * cd /home/[username]/ChatScript; ./LinuxChatscript32 2>/home/[username]/cronserver.log
How can I create something similar for MongoDB?
More From » cron