Block until log matches pattern. Starts tailing from the end of the file.
wait.log.pattern('/path/to/log', 'foobar')
Block until log matches multiple patterns.
wait.log.pattern('/path/to/log', ['foo', 'bar'])
Wait for log file to exist.
wait.log.exists('/path/to/log')
An optional run
argument which defaults to False
is available. If set to
True
the initial function call returns the actual wait function initialized
to the current position.
w = wait.log.pattern('/path/to/log', 'foo', run=False)
# Do something here
w()
Block until tcp port 80 is listening on localhost.
wait.tcp.open(80)
Block until tcp port 80 is closed on localhost.
wait.tcp.closed(80)
Block until tcp port 80 is listening on a remote host.
wait.tcp.open(80, host='www.google.com')
All wait functions take an optional timeout argument which defaults to 300
.
The function will return False
if the timeout is set and exceeded. The
timeout is expressed in seconds.
wait.log.pattern('/path/to/log', ['foo', 'bar'], timeout=5)
An indefinitely blocking call can be created by setting timeout to 0
.
wait.log.exists('/path/to/log', timeout=0)