From 135279c31d1820dc1d81825e2a37d76ff3b8dac9 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sun, 18 May 2008 18:57:14 +0300 Subject: Implemented --sleep=SECS option. --- do-until | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/do-until b/do-until index c4dce85..1f60200 100755 --- a/do-until +++ b/do-until @@ -27,8 +27,8 @@ def do_until(options, argv): if p.returncode == 0: break sys.stderr.write("do-until: command failed, " - "trying again in 1 second\n") - time.sleep(1) + "trying again in %d second(s)\n" % options.sleep) + time.sleep(options.sleep) def parse_args(args): @@ -38,6 +38,9 @@ def parse_args(args): "pretend that it succeeds.") parser.add_option("-v", "--verbose", action="store_true", help="Print command before executing it.") + parser.add_option("--sleep", type="int", default=1, metavar="SECS", + help="Wait SECS seconds before re-trying a command. " + "(Default is %default.)") options, argv = parser.parse_args(args) -- cgit v1.2.1