waitfor(1) - Linux man page

Name

waitfor - polls until specified network resource is available or event has occured

Synopsis

waitfor [-?, --help] [-p, --poll delay] [-w, --wait delay] [-v, --verbose] test...

Description

This utility will wait until a url is available, until a port is being listened to, until an amount of time has passed or until a shell command succeeds. It's very useful when you want to coordinate the startup or shutdown of services. Each item you wish to wait for is specified on the command line as a series of URLs. The program will repeatedly test each one until it 'succeeds' or until the maximum wait time is exceeded.

You specify the resources you're waiting for as URLs such as:

*

<http url> retrieve web page

*

<ftp url> retrieve ftp file

*

<file url> verify existance of file

*

cmd:<command> verify success of command

*

port:[<host>:]<port> check for TCP connection

*

time:<delay> interval passed (in seconds)

Prefix any test with '!' to wait for it to fail instead.

Invoked with the -? option, the program prints a usage summary and exits.

The -p option allows you to set how frequently the program should attempt to check the tests. The default is 1 second.

The -w option allows you to set how long the program will wait for the tests to succeed (before exiting with a 1 error code). The default is to wait forever.

The -v option will log all tests as they're being executed. It's mainly useful for debugging.

Requirements

waitfor was written in Python 2.3.3. It may not work with earlier versions.

Bugs

Occasionally, hitting ctrl-break will not exit the program, and you will have to hit it a second time (a bit harder).

Author

Denis Hennessy <denis@hennessynet.com>.

There is a project web page at http://www.hennessynet.com/waitfor/: http://www.hennessynet.com/waitfor/.