Wait Up

Perl, cross-platform

This is a trivial program I just ran off in a few minutes, but it might be useful to others. Imagine the situation: A server is offline, and you are waiting for it to come online. In my case, my web hosting service was down, and I was waiting for it to come back online. As it happens, by the time I finished the program, the server was back up!

The program simply tries to connect via TCP to a given port on a given server, pausing between each try. If it succeeds, it prints out a success message and quits, otherwise it keeps going until it either succeeds or the user kills it.

It’s written in Perl, and also requires the Time::HiRes module from CPAN.

You can do some useful things with it, such as this OS X example

> waitup.pl example.com 80 && say 'The server is back up'

Which will speak to you when the server is ready.

Instructions

Wait Up—Scans at intervals until a server is up

Copyright (c) Paul Battley / po-ru.com / July 2002

This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute and modify it under the terms of the GNU General Public License (see http://www.fsf.org/licenses/gpl.html for more information).

About

This program simply repeatedly attempts to connect to a given server on a given port until it either succeeds or is killed.

Usage

waitup [options] host[:port]

Port is optional; default value is 80 (HTTP).

Options

--pause N

Number of seconds to wait after each failed attempt before the next.

--timeout N

Timeout in seconds for connection attempts.

--help

View the documentation (this is it!).

Download

Comments

Skip to the comment form

  1. Kevin

    Wrote at 2006-07-06 18:47 UTC using Firefox 1.5.0.4 on Windows XP:

    Interesting program, I guess a bash statement such as ‘ping -t hostname:port’ would do the same thing.

    I like your site though. Looks like you have some cool interests.

Leave a comment

Please read the comment guidelines before posting. Comments are Gravatar-enabled. Your email address will not be published.

To prove that you’re human, type human in the Bot check field.

Trying to post some program output or a long code sample? Please use a paste service and link to it instead.