ftp and crontab

Hello all,

I've a shell account with a shell provider(OS: FreeBSD 4.11-STABLE). I wanted to ftp a file from my home directory to my c drive on every sunday. I wanted to make this process automated. right now i do manually. Can someone help me pls?

Thanks

Is it between Unix and Windows machines ?

yeap i'm using windows

Hi ...

You can write a script to do that ftp operation to send file to your machine and the drive you want.

And the schedule it in Cron That will work.

Thanks & Regards,
Arun...

Appologies to post again . If you want the script i will do send ...

please, can i have a script? thx

you an use

#!/bin/sh
cd yourhomedirectory
ftp -n localhost <<!
quote user YourUserName
quote pass YourPassword
binary
lcd c:/yourdirectory
put yourfilename
quit
!

save it and execute it

thank you arunkumar: so this script will ftp from unix machine to my c drive?

Nope no luck

#!/bin/sh
cd /home/user
ftp -n localhost <<!
quote user user
quote pass mypassword
binary
lcd C:\TEST
put ftptest.txt
quit
!

./tst.sh
ftp: local: C:TEST: No such file or directory

BUT C:\TEST directory exist on my c drive.. i set the permissions and then tried.

./tst.sh
ftp: local: C:TEST: No such file or directory

Hi, can anyone help me pls, i still have no luck

Hi.
I think you should do:
cd C:\TEST
instead of
lcd C:\TEST
Assuming you are running the script on an unix box and the remote is windows.
You could also use $HOME/.netrc
if you do not want to put your usr/pwd in the script. Although I would use ssh with certificates...
Regards.

thx grial, i've changed lcd C:\TEST to cd C:\TEST but still i get
C:TEST: No such file or directory. But C:\TEST does exist on my c drive.

Are you really using this?:

In that case, are you using "localhost" as the destination server? If so, it should be your Windows' IP/name... I mean if you want to ftp from Linux to Windows, you are ftp-ing to yourself (linux)... I think the script is fine...

hi ..

There are several quertions from my side
#!/bin/sh
cd /home/user
ftp -n localhost <<!
quote user user
quote pass mypassword
binary
cd C:\TEST
put ftptest.txt
quit
!

here in the script what is localhost.... are you trying to transer file to the local host...I cant get that....UNIX to UNIX

no CD will not work i thind so since lcd "Local CUrrent Directory"...Give the ipaddress in the place of local host amd try it....
chmod 777 ftptest.txt in unix machine....
try with all these and let me know....

Thanks,
Arun.

Nope, still no luck, i'm ftping from unix to my c drive.

Assuming this situation:

Unix ----FTP----> Windows (111.222.333.444)

This works for me:

(Notice "cd /TEST" instead of "cd C:\TEST")
What's the ftp server you are using? IIS?

Thanks grial, i'm using window XP and now atleast its trying to connect but
it says
ftp: connect: Operation timed out
Not connected.
--

#!/bin/sh
cd /home/user
ftp -n 195.155.24.107<<EOT
quote user unixuser
quote pass unixuserpass
binary
cd /TEST
put test.txt
quit
EOT

are you able to ftp without the script ... I mean try ftp step by step in prompt....

If the same error occurs ..let me know...

trp ping yourip

is it pinging ?????????

Thanks,
Arun.

thx arunkumar_mca: actually when i try manually it says the same
ftp: connect: Operation timed out

and no when i ping then i get this
/sbin/ping: Permission denied.

thx arunkumar_mca: actually when i try manually it says the same
ftp: connect: Operation timed out

---- shows that your ip is wromg or ypu donr have permission

and no when i ping then i get this
/sbin/ping: Permission denied.

Go to windows command prompt

type
ping address

let me know thw result.

Thanks,
Arun