I am trying to write a script that grabs a picture from a web cam every 30 second and every 30 minutes copies it to create an archive of pictures. To further complete things, I have two servers that this script needs to run on but the script only runs on one server depending on the status it reads from another server. The problem I am having is the subroutine that run every 30 minutes (move_pic) never runs. I will include the code that I have so far, but if any one can suggest a better way I would be happy to hear it.
snip...
my $host = qx { hostname --short };
snip...
sub check { my $kernel = $_[KERNEL];
my $servermon = qx { nc -w 2 $lb 5000};
if ($servermon eq $host) {; print "Check\n"; $kernel->delay(move_pic => 30); $kernel->delay(get_pic => 10); } else { $kernel->delay(check => 120); } }
You don't say what your hostnames are, nor what the service running on port 5000 returns. My first guess is that it doesn't return something that exactly matches $host. Also, you're delaying two events (move_pic and get_pic), both of which appear to yield to check, so you're likely to have progressively increasing number of concurrent check events.
