ncftp nice ftp using automated backup file

ncftp how can i use ncftp with a shell script ?
PLEASE SHOW AN EXAMPLE SMALL SCRIPT with -z option for autoresuming


ncftp -u server -p jackandjillpassword myhomeserver.com
put /root/websitebackup.tgz websitebackup.tgz
put /root/nameserverbackup.tgz nameserverbackup.tgz
put /root/mailstuffbackup.tgz mailstuffbackup.tgz
put -z /root/alldatabases.tgz alldatabases.tgz

LVL 1
aot2002Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

sigel1Commented:
A program called expect can do the job.
Use http://www.linuxlots.com/~barreiro/spain/expect/expect_tut-8.html examples.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
aot2002Author Commented:
im using this script but it only goes to the ftp login prompt and wont continue futher ?









#!/usr/bin/expect -f
#
set force_conservative 0  ;# set to 1 to force conservative mode even if
                          ;# script wasn't run conservatively originally
if {$force_conservative} {
        set send_slow {1 .001}
        proc send {ignore arg} {
                sleep .1
                exp_send -s -- $arg
        }
}
set timeout 6
puts "\n"
#
spawn ncftp -u linux -p test myspecialdomainathome.com
#spawn ftp localhost
expect "ncftp / >"
#send -- "\r"
#expect "Password:"
#send -- "barreiro@arrakis.es\r"
#expect -exact "ftp> "
#send -- "binary\r"
#expect -exact "ftp> "
#send -- "hash\r"
#expect -exact "ftp> "
#send -- "cd pub/spain/gnome\r"
#log_user 1
#expect -exact "ftp> "
#send -- "ls\r"


#send -- "put /root/webmin-1.130-1.noarch.rpm test.rpm"
#expect "could not open file"
#send -- "\r"

#send -- "put /root/websitebackup.tgz websitebackup.tgz"
#expect "could not open file"
#send -- "\r"

send -- "put /root/nameserverbackup.tgz nameserverbackup.tgz"
expect "could not open file"
send -- "\r"

send -- "put /root/mailstuffbackup.tgz mailstuffbackup.tgz"
expect "could not open file"
send -- "\r"

send -- "put -z /root/alldatabases.tgz alldatabases.tgz"
expect "could not open file"
send -- "\r"

send -- "put /root/all_logs.tgz all_logs.tgz"
expect "could not open file"
send -- "\r"

#puts "\n"
exit




It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Installation

From novice to tech pro — start learning today.