[Techtalk] ftp backup perl script

mike at coconutisland.com mike at coconutisland.com
Tue May 25 12:49:15 EST 2004


      I have been using this simple perl script to ftp backup files.  It has
worked well.  Now I am in a new situation, and have modified it to use
Net::Cmd to pass the "passive" command, to turn off passive mode, as
required by the new backup server.

      This script will now put the file name, but not the data, and it exits
with the "Couldn't upload..." error message.  The file name can be viewed in
the new location with 0 bytes of data.

      The originating server is redhat linux, don't know about the backup
machine.

      Any ideas?

      Thanks - Mike Clark, mike at coconutisland.com

      #!/usr/bin/perl
      $testpath = "/backup/old";
      $testfile = "mysql.1Mon.tar.gz";
      use Net::FTP;
      use Net::Cmd;

      $ftp = Net::FTP->new("backups.ev1servers.net") or die "Couldn't
connect to backups.ev1servers.net: @\n";
      $ftp->login("user", "pwd") or die "Couldn't login\n";
      $ftp->quot ("CMD [,passive]");
      $ftp->put("$testpath/$testfile") or die "Couldn't upload
$testpath/$testfile\n";
      $ftp->quit();




More information about the Techtalk mailing list