title: Stopping a timed thread in python
body: <p>I'm trying to stop a thread in python when the main script is killed. But since the thread is started hourly how do i stop the thread immediately?</p>
  
  <pre><code>def interval():
      ###the actual work being done here###
      try:
          threading.Timer(3600, interval).start()
      except (KeyboardInterrupt, SystemExit):
          print "Exiting"
          cleanup_stop_interval();
          sys.exit()
  interval()
  </code></pre>