Re: [SLUG] scripting ftp login
> Benno wrote: >> On Wed Oct 13, 2004 at 09:39:12 +1000, Alexander Samad wrote: thanks for all the suggestion ! I saved them all for future reference, meanwhile, set the script as per the 1st reply ... (gzip stuff snipped) echo "$now $0 executed on in $exectime sec" ftp -n $HOST <
Re: [SLUG] scripting ftp login
Benno wrote: On Wed Oct 13, 2004 at 09:39:12 +1000, Alexander Samad wrote: Just a suggestion why not use scp Alex On Wed, Oct 13, 2004 at 09:17:29AM +1000, Voytek Eymont wrote: I have a simple backup script like: cd /home for i in *.* ; do echo 'now processing' $i tar cfz $i.tar.gz /home/$i echo 'finished processing' $i done - at completion, I'd like to login to ftp and mput *.gz; how do I script ftp user/pass/commands ? Well reading the man page for my ftp program you just specify these on the command line: ftp user:[EMAIL PROTECTED], but I just realised that was the man page on a bsd box, standard linux ftp program doesn't appear to support that. lftp appears to support something similar though. Cheers, Benno You can "script" ftp by using an input file instead of stdin. The logon can be automated with .netrc (man netrc). For example: Sample .netrc machine ftp.some.domain login someuser password somepassword Now setup an ftp script file, for example ftp_script might contain: ls disconnect bye Now execute # ftp ftp.some.domain < ftp_script This would output a listing of the base folder on the ftp site and then disconnect and exit ftp back to the shell. No interaction. Fil -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
Re: [SLUG] scripting ftp login
Voytek Eymont wrote: at completion, I'd like to login to ftp and mput *.gz; how do I script ftp user/pass/commands ? man ncftpput DESCRIPTION The purpose of ncftpput is to do file transfers from the command-line without entering an interactive shell. This lets you write shell scripts or other unattended processes that can do FTP. It is also useful for advanced user who want to send files from the shell command line without entering an interactive FTP program such as ncftp. cheers rickw -- _ Rick Welykochy || Praxis Services gizza, n: the Australian for "give us a" as in "gizza go" -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
Re: [SLUG] scripting ftp login
On Wed Oct 13, 2004 at 09:39:12 +1000, Alexander Samad wrote: >Just a suggestion why not use scp > scp can be a bit painful too. You need to use passphraseless keys, which is a bit of a worry. (Well unless it is an interactive script..) -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
Re: [SLUG] scripting ftp login
On Wed Oct 13, 2004 at 09:39:12 +1000, Alexander Samad wrote: >Just a suggestion why not use scp > >Alex > >On Wed, Oct 13, 2004 at 09:17:29AM +1000, Voytek Eymont wrote: >> I have a simple backup script like: >> >> cd /home >> >> for i in *.* ; do >> echo 'now processing' $i >> tar cfz $i.tar.gz /home/$i >> echo 'finished processing' $i >> done >> >> - >> at completion, I'd like to login to ftp and mput *.gz; >> how do I script ftp user/pass/commands ? Well reading the man page for my ftp program you just specify these on the command line: ftp user:[EMAIL PROTECTED], but I just realised that was the man page on a bsd box, standard linux ftp program doesn't appear to support that. lftp appears to support something similar though. Cheers, Benno -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
Re: [SLUG] scripting ftp login
On Wed, Oct 13, 2004 at 09:36:51AM +1000, Voytek wrote: > > > >> I have a simple backup script like: > > > Googling script ftp linux brought up this, looks pretty good: > > http://www.users.qwest.net/~eballen1/scripting.ftp.html > > > > If the remote server is under your control, scp or rsync might provide a > > better general solution. > > thank, Rog > > yes, but I do not have rsyncd nor sshd on it, only ftpd have a look at ncftp you can do something like ncftpput -f X.cfg DestDir SrcFiles X.cfg looks like host hostname user username pass password > > and, this is probably a one off, I transferred all web files to a new > server, now, I want to back it up to the old server before I remove it > > -- > Voytek > -- > SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ > Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html > signature.asc Description: Digital signature -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
Re: [SLUG] scripting ftp login
Just a suggestion why not use scp Alex On Wed, Oct 13, 2004 at 09:17:29AM +1000, Voytek Eymont wrote: > I have a simple backup script like: > > cd /home > > for i in *.* ; do > echo 'now processing' $i > tar cfz $i.tar.gz /home/$i > echo 'finished processing' $i > done > > - > at completion, I'd like to login to ftp and mput *.gz; > how do I script ftp user/pass/commands ? > > > -- > Voytek > -- > SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ > Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html > signature.asc Description: Digital signature -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
RE: [SLUG] scripting ftp login
>> I have a simple backup script like: > Googling script ftp linux brought up this, looks pretty good: > http://www.users.qwest.net/~eballen1/scripting.ftp.html > > If the remote server is under your control, scp or rsync might provide a > better general solution. thank, Rog yes, but I do not have rsyncd nor sshd on it, only ftpd and, this is probably a one off, I transferred all web files to a new server, now, I want to back it up to the old server before I remove it -- Voytek -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
Re: [SLUG] scripting ftp login
Voytek Eymont wrote: I have a simple backup script like: cd /home for i in *.* ; do echo 'now processing' $i tar cfz $i.tar.gz /home/$i echo 'finished processing' $i done - at completion, I'd like to login to ftp and mput *.gz; how do I script ftp user/pass/commands ? A simple redirection of input should do I think. Eg ftp < ftp_script where ftp_script is a plain text file which contains the ftp commands you need to process to get it done - one per line. Fil -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
RE: [SLUG] scripting ftp login
> I have a simple backup script like: --snip-- > - > at completion, I'd like to login to ftp and mput *.gz; how do > I script ftp user/pass/commands ? Googling script ftp linux brought up this, looks pretty good: http://www.users.qwest.net/~eballen1/scripting.ftp.html If the remote server is under your control, scp or rsync might provide a better general solution. - Rog -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html