All pastes #243214 Raw Edit

Untitled

public text v1 · immutable
·published 2006-11-08 05:54 UTC
rendered paste body
sub get_rvhosts {

        my @forkarray;
        my @filenames;
        foreach my $file ( @remote_rvproxy_configs ) {
                my $filename = $file =~  /\/config\/(.*)$/;
                push ( @filenames, $filename );

                my $f = fork;
                if ( defined $f and $f == 0) {  # inside the fork

                        if (  ( (stat( $local_storage.$filename))[9] - time) > 86400 ) {
                                if ( ( grep { /received/} `ping -c 1 -w 1 $config_source` =~ /^,\s*(\d)\s*received/ ) == 1 ) {
                                        system("rcp $config_source:$file $local_storage") or die scalar(localtime)," : Couldn't get $file\n";
                                }
                        }
                        exit (0);
                }
                else {
                        push ( @forkarray , $f );
                }
        }
        waitpid($forkarray[-1],0);