Skip to content

Instantly share code, notes, and snippets.

@EggPool
Created September 14, 2018 12:41
Show Gist options
  • Save EggPool/e7ad9baa2b32e4d7d3ba658a40b6d643 to your computer and use it in GitHub Desktop.
Save EggPool/e7ad9baa2b32e4d7d3ba658a40b6d643 to your computer and use it in GitHub Desktop.
Bismuth Node Sentinel
"""
Bismuth Node
Cron sentinel by @iyomisc
To be run every minute.
"""
import subprocess
# Edit this if you are not using the standard invocation
PYTHON_EXECUTABLE='python3'
list_ = subprocess.getoutput("screen -ls")
try:
if ".node\t" not in list_:
print("Restarting stopped Node...")
data = subprocess.getoutput('screen -d -S node -m bash -c "{} node.py" -X quit'.format(PYTHON_EXECUTABLE))
print("started")
except:
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment