Created
October 24, 2013 18:40
-
-
Save jferguson-gnubio/7142688 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| [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 |
This file contains hidden or 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/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