how to lftp mirror in a bash
Friends
I wish to have a script that will do a lftp mirror that will sync up a local dir to the ftp dir local dir is is an external drive on my dsktop /media/facing_history_1/00 where facing_history_1 is the drive and 00 is a dir I wish for the files to go to the remote dir is on the ftp server 172.16.100.101 , the user is editor the password apple and the dir that I wish to source from is : array1/f_t Note: i can do it manually - but wish to have a script that i can cron. here is the script I am currently trying <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 -u username,password -e >> LOGFILE #lftp 172.16.100.101 -u editor,apple cd array1/f_t mirror -c >> $log lftp 172.16.100.101 -u editor,apple cd array1/f_t mirror -c exit echo end $(date) >> $log echo ............ >> $log </code> currently when I run this script i DO get to the ftp server but it 'stalls' at root - meaning the cd array1/f_t never happens nor does the mirror -c happen when i run it I am logged into the server and in that shell i can do a dir and see where i am and I can manually put in : cd array1/f_t , and that gets me there and I can manually put in mirror -c , and that pulls the files. so __ how do i put this all on 1 line and have it all happen as you can see i did try - all 1 line - lftp 172.16.100.101 -u editor,apple cd array1/f_t mirror -c and I have tried in 3 lines lftp 172.16.100.101 -u editor,apple cd array1/f_t mirror -c but it stalls after the logIn thanks z |
ok I have something that is sorta working
<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 -u username,password -e >> LOGFILE #lftp 172.16.100.101 -u editor,apple cd array1/f_t mirror -c >> $log #lftp 172.16.100.101 -u editor,apple #set 'cd array1/f_t' # mirror -c ###lftp -c 'open -e "set ftp:list-options -a; mirror -a --parallel=10 -v fromdir/ ./todir" -u user,pass host' lftp -c 'open -e "set ftp:list-options -a; mirror -a -v array1/f_t/ ./media/facing_history_1/00" -u editor,apple 172.16.100.101 >> $log' exit 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 editor,apple 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 editor,apple 172.16.100.101' and it does not go to echo end $(date) >> $log echo ............ >> $log i suppose that is the exit but I was thinking the exit -- there-- would exit the ftp and --sorta-- drop back into bash space how might one do that 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 any wisdom would be appreciated |
All times are GMT -5. The time now is 05:38 AM. |