From cdf18074bc6f1df4bc2a605f5fc048b9af104a1b Mon Sep 17 00:00:00 2001 From: Matt Singleton Date: Sun, 3 Sep 2017 14:09:26 -0400 Subject: run once and exit argument --- unbiased/main.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/unbiased/main.py b/unbiased/main.py index caf77eb..4ccda24 100755 --- a/unbiased/main.py +++ b/unbiased/main.py @@ -51,6 +51,7 @@ def main(): parser.add_argument('webroot', help='location to write html output') parser.add_argument('-l', '--log-dir', help='location to write detailed logs') parser.add_argument('-d', '--debug', action='store_true', help='run in debug mode') + parser.add_argument('-o', '--oneshot', action='store_true', help='run once and exit') args = parser.parse_args() if args.log_dir: @@ -71,6 +72,8 @@ def main(): runtime = finish - start sleeptime = crawl_frequency - runtime logger.info('Crawl complete in {}s. Sleeping for {}s'.format(int(runtime), int(sleeptime))) + if args.oneshot: + break if sleeptime > 0: time.sleep(sleeptime) -- cgit v1.2.3