## Developed for Sypris Electronics. import os import signal import webbrowser TARGET_PROCESS = "firefox" BLANK_URL = "about:blank" LOOP_DELAY = 10 ## In seconds def KillFF(): for line in os.popen("ps xa"): fields = line.split() pid = fields[0] process = fields[4] if process.find(TARGET_PROCESS) > 0: os.kill(int(pid), signal.SIGKILL) break ## Kill only one instance def SpawnFF(): webbrowser.open_new(BLANK_URL) def Loop(): print "Starting the cycle of opening and closing Firefox every " + str(LOOP_DELAY) " seconds." while True: SpawnFF() time.sleep(LOOP_DELAY) KillFF()