| Linux - Server This forum is for the discussion of Linux Software used in a server related context. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
01-22-2013, 11:59 AM
|
#1
|
|
Member
Registered: Nov 2005
Location: cincinnati , ohio . USA
Distribution: ubuntu , Opensuse , CentOS
Posts: 119
Rep:
|
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
|
|
|
|
01-22-2013, 01:09 PM
|
#2
|
|
Member
Registered: Nov 2005
Location: cincinnati , ohio . USA
Distribution: ubuntu , Opensuse , CentOS
Posts: 119
Original Poster
Rep:
|
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
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 10:15 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|