Created
July 27, 2019 12:34
-
-
Save EggPool/63f146c6c6b7de8e0929a09dc190c62e to your computer and use it in GitHub Desktop.
Bismuth Node Sentinel Python 3.7
This file contains 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. | |
Updated for Python3.7 by default | |
""" | |
import subprocess | |
# Edit this if you are not using the standard invocation | |
PYTHON_EXECUTABLE='python3.7' | |
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