Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- import os
- import commands
- import datetime
- now = datetime.datetime.now().strftime("%Y-%m-%d %H:%M")
- try:
- int(commands.getoutput('pidof mongod'))
- print ("[{0}] Mongo is fine, nothing to see here...").format(now)
- except:
- os.system("/bin/bash /etc/init.d/mongod start")
- print("[{0}] Mongo died. Restarting...").format(now)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement