Created
February 12, 2016 23:25
-
-
Save jwygralak67/f70c8ae52234d102159e to your computer and use it in GitHub Desktop.
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
#!/usr/bin/python | |
import subprocess | |
import time | |
RUNNING = 1 | |
STOPPED = 0 | |
global state | |
state = STOPPED | |
def foo(): | |
global state | |
global proc | |
if state == RUNNING: | |
print"Stopping thing2" | |
proc.kill() | |
state = STOPPED | |
else: | |
print"Starting thing2" | |
proc = subprocess.Popen(["python", "thing2.py"]) | |
state = RUNNING | |
while True: | |
raw_input("Press Enter:") | |
print "" | |
foo() | |
time.sleep(1) |
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
#!/usr/bin/python | |
from time import sleep | |
while 1: | |
print "I'm alive" | |
sleep(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment