# HG changeset patch # User Jeff Hammel # Date 1422390105 28800 # Node ID 04c5464355b816d91fac3e3b2d7045904ed81e1b # Parent d9d7bfdb54dbf6fae5c65956ce8f35f255b3bb10 monitor diff -r d9d7bfdb54db -r 04c5464355b8 makeitso/python_package/{{package}}/{{main}}.py --- a/makeitso/python_package/{{package}}/{{main}}.py Fri Nov 21 14:36:17 2014 -0800 +++ b/makeitso/python_package/{{package}}/{{main}}.py Tue Jan 27 12:21:45 2015 -0800 @@ -10,6 +10,7 @@ import os import subprocess import sys +import time # module globals __all__ = ['main', 'Parser'] @@ -32,6 +33,9 @@ kwargs.setdefault('formatter_class', argparse.RawTextHelpFormatter) kwargs.setdefault('description', __doc__) argparse.ArgumentParser.__init__(self, **kwargs) + self.add_argument('--monitor', dest='monitor', + type=float, metavar='SLEEP', + help="run in monitor mode") self.options = None def parse_args(self, *args, **kw): @@ -50,5 +54,15 @@ parser = Parser() options = parser.parse_args(args) + try: + while True: + if options.monitor: + time.sleep(options.monitor) + else: + break + except KeyboardInterrupt: + pass + if __name__ == '__main__': main() +