summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@iki.fi>2008-05-18 18:57:14 +0300
committerLars Wirzenius <liw@iki.fi>2008-05-18 18:57:14 +0300
commit135279c31d1820dc1d81825e2a37d76ff3b8dac9 (patch)
treee03e87b03e84a1aae63695ec994225a15536a080
parent3e6713ab149a0db329ec8e45d621d3c3b44ea77d (diff)
downloadextrautils-135279c31d1820dc1d81825e2a37d76ff3b8dac9.tar.gz
Implemented --sleep=SECS option.
-rwxr-xr-xdo-until7
1 files 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)