Re: ftp site

From: Tom Zamani <tomz_at_redflex.com.au>
Date: 2000/06/14
Message-ID: <8i6pg7$hdp$1_at_perki.connect.com.au>#1/1


Is there any thing else that you whish to have????

This will give you some Idea.

tom

#!/usr/bin/ksh

SCRIPT_HOME=`/usr/bin/dirname $0`
. $SCRIPT_HOME/setenv.sh

if [ $# -lt 6 ]
then

    echo "Usage $0:<Action put or get> <file to send> <ftp username> <ftp password> <ftp site> <user prefix> <if get where to>"

    exit 1
fi
# Pick up the arguments.

action=$1
sendfilename=$2
username=$3
userpassword=$4
ftpsite=$5
userprefix=$6
getfilepath=$7

SENDFILEPATH=`/usr/bin/dirname $sendfilename` SENDFILEBASE=`/bin/basename $sendfilename` if [ "$action" = "put" ]
then
# ftp the file put

/usr/bin/ftp -n -v $ftpsite << !! > $LOGFILEDIR/$userprefix/$LOGFILENAME 2>&1

    user $username $userpassword
    lcd $SENDFILEPATH
    $action $SENDFILEBASE
    bye
!!
else
# ftp the file get

/usr/bin/ftp -n -v $ftpsite << !! > $LOGFILEDIR/$userprefix/$LOGFILENAME 2>&1

    user $username $userpassword
    lcd $getfilepath
    $action $SENDFILEBASE
    bye
!!
fi
# check for success

result=`/bin/grep "Transfer complete"
$LOGFILEDIR/$userprefix/$LOGFILENAME|/usr/bin/cut -c5-21` if [ "$result" = "Transfer complete" ]
then
# echo $result
# echo "success!"

    exit 0
else
# echo $result
# echo "fail!"

    exit 1
fi

Nick G. Anagnos <anagnon_at_westat.com> wrote in message news:39468C5A.D91AF75E_at_westat.com...

> Does anyone have a script that ftp's to another server and gets a *.dmp
> and then runs an import.
>
> Nick
>
Received on Wed Jun 14 2000 - 00:00:00 CEST

Original text of this message