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.
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).
This program simply repeatedly attempts to connect to a given server on a given port until it either succeeds or is killed.
waitup [options] host[:port]
Port is optional; default value is 80 (HTTP).
Number of seconds to wait after each failed attempt before the next.
Timeout in seconds for connection attempts.
View the documentation (this is it!).
2005-07-26 15:11 UTC. Comments: 1.