#!/home/benson/anaconda3/bin/python import os import subprocess base_dir = os.path.dirname(os.path.realpath(__file__)) result = subprocess.run(["%s/ProcessExists" % (base_dir)], stdout=subprocess.PIPE) res = int(result.stdout) if res == 0 and os.path.isfile('%s/../time.txt' % (base_dir)): subprocess.Popen('%s/LaunchInterrupt' % (base_dir)) else: print("Don't need to restart!")