in reply to Self resurrecting perl scripts
sub get_files { # ftp files from remote server while (1) { $ftp = Net::FTP->new("$From_Host", Debug => 0); $ftp->login("$From_User","$From_Pass") || do { &print_ +ftp_error; redo; }; $ftp->cwd("$From_Dir"); (@dir_files = $ftp->dir) || do { &print_ftp_error; red +o; }; $ftp->quit; last; } sub print_ftp_error { # Error handling proc $save = $ftp->error; $ftp->quit; print STDERR "ftp error: $save\n"; print_to_log("ftp error: $save\n"); if (++$ftp_errors{"$save"} >= $Max_ftp_Errors) { print STDERR "\n\nExceeded maximum number of ftp error +s. Exiting!!!\n"; print_to_log("\n\nExceeded maximum number of ftp error +s. Exiting!!!\n"); system("$Notify_Proc \"ftpfiles.pl Exceeded maximum nu +mber of ftp errors. Please check $Log_File.\" 2>&1 > /dev/null"); rename "$Log_File", "$Log_File.$year.$mon.$mday\_$hour +.$min"; exit 1; } else { # # Give the ftp server a 60 second grace period to get # it's act together. # sleep 60; } }
birdbrane
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Self resurrecting perl scripts
by RhetTbull (Curate) on Apr 12, 2001 at 18:41 UTC |