-   Linux - Software (
-   -   lftp scripting (

Linux_420 07-28-2012 07:26 PM

lftp scripting
I am attempting to write an lftp script that mirrors directories to a remote server. The main problem I have is that I can not be sure weather or not the "verify-file" script included with lftp is executing.

I've issued the following commands after establishing a connection via an expect script:


set xfer:verify yes

set xfer:verify-command "/usr/share/verify-file" yes
I am on Fedora so the path to that script is correct.

The "verify-file" script is a perl script & I know very little about perl. Perhaps I could make a copy of the file & set it as verbose to ensure that it is indeed being executed. I uploaded a large file to see if there was a pause after the transfer was complete. There was no difference between a file that was a few kb in size or one that was several hundred mb.

EDIT: I've changed other "xfer:*" settings to test things like remote directory and they work. I also realized lftp has a status during transfers that tells what it's doing (i.e. "changing remote directory")

I have tried running lftp from both root & a regular user from the client.

I guess I should ensure the open-ssl libs were used during the compile of lftp. I did not compile it myself so, as with everything else this is turning into something complicated. Will continue to update my progress &, if I ever get it to work, the script itself.

chrism01 07-29-2012 06:30 PM

You could do a test by running a script on the target system that messes with the incoming dir ;)

Linux_420 07-30-2012 10:32 AM

I suppose that would ensure the server is capable of running the script. I assumed that the client was the machine running it I put lftp in debug mode but that didn't help much. I checked to see which libraries were installed and neither openssl nor gnu tls showed up but I can seein debugging mode that the connection is secure. I tried setting the xfer:verify boolean with both yes and true. The xfer: verify setting will not allow me to set the path to the verify script as anything other than
"/usr/share/lftp/verify-file" even when lftp is run as root. That should not be a problem though. I thought about compiling lftp from source but seeing as the connection is secure even without the ssl or tls libs i doubt that is the problem, though it may be. Perl is doing the check sums anyway. I did install more peel modules to extend support for md5 but the script isn't even running. Perhaps lftp wasn't set up to run the perl script? I think it is executed within the lftp shell because the script has to know what files or directories to verify.

Linux_420 07-30-2012 08:04 PM

Oh i get what you're saying....good idea. I will try that.

chrism01 07-30-2012 11:34 PM

Also (lateral thinking) if you used scp instead of lftp, scp is very reliable. In fact, I think it checksums stuff anyway during the decrypt at the other end?
If you are using Perl, there are modules for ssh etc. You could do an ssh login after copying and run md5sum or similar.
Just a thought...

Linux_420 08-10-2012 04:11 PM

Well i would use scp but I've got files larger than 4GB on my hard drive. Also i intend to encrypt the files before transferring them. I started using md5deep then used md5sum and finally decided to use openssl to create signed checksums. I am just using an expect script with ftp, ssh, openssl, and i will have to do something to archive some directories but that will be a separate task. I have over 2TB of stuff to get off this raid so i can fix it and I'd like to start keeping off site backups anyway so this should help me set that up whenever i find time to get it done.

All times are GMT -5. The time now is 11:42 AM.