cron to check ftp upload/download

karlp at ourldsfamily.com karlp at ourldsfamily.com
Fri Mar 18 21:03:12 UTC 2005


>
> can u tell me a little sort of script line that i will put in.
>
> wget ftp://tivimtech.com/*.* .......rest i do not know
> how will i specify user name and password ? and will *.* download all file
> of ftp server in any folder?

Frankly, I'd use ftp to do it and run a script like this one I wrote
(you'll have to change the PUT to GET and any associated syntax):

#!/bin/sh
if [ "$6" = '' ] &&
   [ "$5" = '' ] &&
   [ "$4" = '' ] &&
   [ "$3" = '' ] &&
   [ "$2" = '' ] &&
   [ "$1" = '' ]
 then
   echo
   echo Usage: $0 DestHost USERNm PASSWd LocalPth2Dir RemotePth2Dir FNAME
   echo
   exit 1
fi
HOST=$1
USERNM=$2
PASSWD=$3
LPATH=$4
RPATH=$5
FNAME=$6
ftp -p -n $HOST 2>/dev/null  <<- End_of_FTP_commands
user $USERNM $PASSWD
lcd $LPATH
cd $RPATH
put $FNAME
End_of_FTP_commands

This is just an idea for you to try. I use the above script in production
many times an hour and it works fine. Of course, I know the filename to
put... You can do the same thing with ssh and sftp, too, if you like. the
major portion is the use of the <<- EOC which give the shell the power to
enter the next lines within the ftp 'shell'. Cool stuff this is.

Hope That Helps (HTH)

Karl
>
> rgds
>
> ajay
>
> On Thu, 17 Mar 2005 Smith,Albert wrote :
>>You can try and use wget -mirror and the location location of the ftp
>>server and the files. This will do a complete transfer of everything in
>>the path specified. And do it every hour you can write a script to do
>>the transfer and dump it /etc/cron.hourly
>>
>>
>>
>>Albert Smith
>>Sr. Unix Systems Administrator
>>HPCSA, RHCT
>>Genex Services
>>440 E. Swedesford Rd.
>>Wayne, PA 19087
>>albert.smith at genexservices.com
>>(610) 964-5154
>>
>>
>>
>>________________________________
>>
>> 	From: redhat-install-list-bounces at redhat.com
>>[mailto:redhat-install-list-bounces at redhat.com] On Behalf Of ajay
>>chaudhary
>> 	Sent: Thursday, March 17, 2005 6:59 AM
>> 	To: redhat-install-list at redhat.com
>> 	Subject: cron to check ftp upload/download
>>
>>
>>
>> 	  sir can you tell me:
>>
>> 	we have a ftp server ftp://trivimtech.com on which our client
>>put files for our work (50-200mb) and we have to fetch them frequently
>>
>> 	i want it to do with wget and want to schedule it for 1hr , it
>>automatically will go on ftp server , check what is left to download and
>>if any new file it download it.
>>
>> 	my folder on ftp:/trivimtech.com is "from macmilan"
>>
>> 	and after finishing file work in our lab as we put it on our
>>linx server (rh9.0) in "finished" it gets uploaded by itself in "to
>>macmilan" folder on our ftp server.
>>
>> 	is there any ready software for this purpose. and how should i
>>use cron for this purpose. where i put it in crontab?
>>
>> 	regards
>>
>> 	ajay
>>
>>
>>
>>
>> 	 <http://clients.rediff.com/signature/track_sig.asp>
>>
> _______________________________________________
> Redhat-install-list mailing list
> Redhat-install-list at redhat.com
> https://www.redhat.com/mailman/listinfo/redhat-install-list
> To Unsubscribe Go To ABOVE URL or send a message to:
> redhat-install-list-request at redhat.com
> Subject: unsubscribe





More information about the Redhat-install-list mailing list