[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [cobalt-users] Automating ftp
- Subject: Re: [cobalt-users] Automating ftp
- From: "Ing. Ernesto Pérez Estévez" <ernesto@xxxxxxxxxxx>
- Date: Wed May 9 04:19:02 2001
- Organization: Agilweb - Cuenca - Ecuador
- List-id: Mailing list for users to share thoughts on Cobalt products. <cobalt-users.list.cobalt.com>
Well, well.
You can install ncftp and then create a file named transfer.sh, for
example, containing the following (let's suppose we're transfering file
foofile from one server to a second one, using a third machine to
execute the script:
#!/bin/sh
ncftpget ftp://username:password@xxxxxxxxxxxxxx/path/to/file/foofile
ncftpput -u uname -p passwd2 secondservername.tld /path/to/put/the/file/
foofile
# repeat as many ncftpget/ncftpput as you wish
rm -f foofile
# delete all the files you downloaded... if you wish
This script is intended to be executed in a third machine, that's why
I'm getting the file (to my local machine) and then putting it (from my
local machine) to a different machine.
If you intend to execute the script in the target or in the source
machine, then there's no necesity to put or to get, depending on the
machine. (Hope you'll find out how)
save that file with xr------- permissions in your user's folder. So only
that user can see it, then, edit the crontab (with crontab -e) and add
the following line:
*/3 * * * * /path/to/user/dir/transfer.sh &> /dev/null
BTW, */3 means, every 3 minutes to execute it. If you want to schedule
it longer or with different options:
man -a crontab
once inside man, press q to go to the next crontab manual page (the
first manual page is not useful for these options).
This is only ONE of the several ways to doit, maybe not one of the best
(I'm not controlling errors, nor anything fancy). You've to be careful
not to allow anybody but you to read the script file as you'll have to
put the password in it.
Regards
Ernesto
Erik de Vries wrote:
>
> At this time i have to following situation:
>
> every day i have to download a few files from a ftp server and upload them
> to another one.
>
> Since a few weeks we have a cobalt raq 4 server and i know it's possible to
> automate some tasks, but is it possible to create a script that downloads a
> few files from an ftp server to the raq and then upload these files to
> another server? and if it's possible how do i do this?
>
> I hope someone can help me
>
> Greetings Erik de Vries
>
> _______________________________________________
> cobalt-users mailing list
> cobalt-users@xxxxxxxxxxxxxxx
> To Subscribe or Unsubscribe, please go to:
> http://list.cobalt.com/mailman/listinfo/cobalt-users