Skip to content

Instantly share code, notes, and snippets.

@jwygralak67
Created February 12, 2016 23:25
Show Gist options
  • Save jwygralak67/f70c8ae52234d102159e to your computer and use it in GitHub Desktop.
Save jwygralak67/f70c8ae52234d102159e to your computer and use it in GitHub Desktop.
#!/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)
#!/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