I wrote an automated FTP script as follows:
#!/usr/bin/perl -w
use strict;
use Socket;
use Net::FTP;
$site = 'ftp.wolfger.com';
$address = inet_ntoa(inet_aton($site)));
$ftp = Net::FTP->new
(
"ftp.wolfger.com",
Timeout => 60
) or die "Connection failed to $address\n";
$user = "<insert username here>";
$pass = "<insert password here>";
$ftp->login($user, $pass)
or die "Login failed for $user.\n";
$ftp->cwd('./main_html');
$ftp->type('binary');
$local = "/home/wolfger/Shared/Documents/wolfger/howllog.html";
$remote = "howllog.html";
$ftp->put($local, $remote)
or die "Failed to put file $remote.\n";
$ftp->quit()
or die "Could not quit connection to $address\n";
The problem is that sometimes this works fine. Other times, it dies with the message "Failed to put file howllog.html."
I'm at a complete loss for why it sometimes works and sometimes doesn't. One thing I do notice is that after the script is run, I have the following process running on my box:
postfix 18788 1591 0 15:58 ? 00:00:00 pickup -l -t fifo -u -c
Usually killing this process allows the script to work again, but this morning I got not get the script to run successfully at all.
Edit: Added <code> tags. larsen
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.