Skip to content

Instantly share code, notes, and snippets.

@EggPool
Created July 27, 2019 12:34
Show Gist options
  • Save EggPool/63f146c6c6b7de8e0929a09dc190c62e to your computer and use it in GitHub Desktop.
Save EggPool/63f146c6c6b7de8e0929a09dc190c62e to your computer and use it in GitHub Desktop.
Bismuth Node Sentinel Python 3.7
"""
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