bash script to lftp mirror and log
<code>
#!/bin/bash #########_______ test of mirror log=~/log/f_h_logfile.txt batch=00 dest=/media/facing_history_1/$batch cd $dest echo start $(date) >> $log DATE='date +%Y%m%d' #mkdir $DATE echo "Get files" lftp -c 'open -e "set ftp:list-options -a; mirror -a -v array1/f_t/ ./media/facing_history_1/00" -u uname,psswd 172.16.100.101 >> $log' echo end $(date) >> $log echo ............ >> $log </code> but it does not log lftp -c 'open -e "set ftp:list-options -a; mirror -a -v array1/f_t/ ./media/facing_history_1/00" -u uname,psswd 172.16.100.101 >> $log' isn the same as lftp -c 'open -e "set ftp:list-options -a; mirror -a -v array1/f_t/ ./media/facing_history_1/00" -u uname,psswd 172.16.100.101' and it does not go to echo end $(date) >> $log echo ............ >> $log how might one do that? What I would really like to do is capture into a log the file names of the files in the session. I am also trying to have a better understanding of what happens w the lftp -c 'open -e "set ftp:list-options -a; mirror -a -v I have looked at the lftp man page ( that is how i got this far ) but am a bit uncertain of my switch use. example - I wish to do binary ( the default ) is my use of -a correct? any wisdom would be appreciated thanks , thanks much |
lftp has a log option that you may want to look at:
Code:
--log=FILE write lftp commands being exe- |
Quote:
Also look at the ~/.lftp directory and see if it contains a file named transfer_log. If enabled it should have been populated by details about file transfers. If not, you can enable it explicitly by means of Code:
set xfer:log 1 Quote:
Code:
-a same as --allow-chown --allow-suid --no-umask |
1st thanks everyone
Yes I have a log happening with ~/.lftp/transfer_log and that is good but what I actually wish to do is have a list of or know the FileNames of each file lftped down so that I can do a md5sum and compare that hash to the hash that was created on the source. I did move my single quote so that the >> $log is outside as in lftp -c 'open -e "set ftp:list-options -a; mirror -a -v array1/f_t/ ./media/facing_history_1/00" -u uname,psswd 172.16.100.101' >> $log and that is closer Now I can log ( thanks colucix ) and the log looks like Transferring file 'FileName1.ext' Transferring file 'FileName2.ext' Transferring file 'FileName3.ext' so that is way way closer . maybe I will do some sed awk to replace the Transferring file with " " and the single quote for a " " then I should have a list of FileName1.ext FileName2.ext FileName3.ext so -- thanks all This is proving to be an interesting challenge. |
and a special thanks for the statement that the
-a means -a same as --allow-chown --allow-suid --no-umask not ascii . For me I Knew it was not a ascii xfer because the files were video ( file.mov) and they were playable and for others who might read thsi -- in lftp binary is the default. all my stuff above is using that default. |
Quote:
Code:
sed -i -r "s/.*'(.*)'/\1/" $log Code:
sed -i -nr "/Transferring file/s/.*'(.*)'/\1/p" $log |
Hi,
Does anyone know how to monitor lftp transfers for failures? How to redirect messages from STDERR to a log file and that send that file as an attachment in a message to an administrator? Or if you have other suggestions on how to monitor failed transfers or connectivity problems Regards |
All times are GMT -5. The time now is 01:13 PM. |