Skip to content

Instantly share code, notes, and snippets.

@jferguson-gnubio
Created October 24, 2013 18:40
Show Gist options
  • Select an option

  • Save jferguson-gnubio/7142688 to your computer and use it in GitHub Desktop.

Select an option

Save jferguson-gnubio/7142688 to your computer and use it in GitHub Desktop.
[circus]
check_delay = 5
endpoint = tcp://127.0.0.1:5555
pubsub_endpoint = tcp://127.0.0.1:5556
[watcher:watched]
cmd = watched.py
warmup_delay = 0
stdout_stream.class = FileStream
stdout_stream.filename = ./module.log
stdout_stream.max_bytes = 10485760
stderr_stream.class = FileStream
stderr_stream.filename = ./module.log
stderr_stream.max_bytes = 10485760
#!/usr/bin/env python
import logging
import signal
import sys
running = True
log = logging.getLogger(__name__)
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
def signal_handler(signum, frame):
global running
running = False
signal.signal(signal.SIGTERM, signal_handler)
signal.signal(signal.SIGINT, signal_handler)
def main():
log.info("Starting")
while running:
log.info("calling signal.pause()")
signal.pause()
log.info("Something very interesting and important just happened")
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment