cron to check ftp upload/download

Rick Stevens rstevens at vitalstream.com
Fri Mar 18 21:14:29 UTC 2005


karlp at ourldsfamily.com wrote:
>>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

Uh, how about:

#!/bin/bash
if [ $# -lt 6 ]; then
     echo
     echo Usage: $0 remotehost username passwd localpath remotepath fname
     echo
     exit 1
fi
ncftpget -d /var/log/ncftpget.log -u $2 -p $3 $1 $4 $5/$6

----------------------------------------------------------------------
- Rick Stevens, Senior Systems Engineer     rstevens at vitalstream.com -
- VitalStream, Inc.                       http://www.vitalstream.com -
-                                                                    -
-   The light at the end of the tunnel is really an oncoming train.  -
----------------------------------------------------------------------




More information about the Redhat-install-list mailing list