Created
September 14, 2018 12:41
-
-
Save EggPool/e7ad9baa2b32e4d7d3ba658a40b6d643 to your computer and use it in GitHub Desktop.
Bismuth Node Sentinel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
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