#!/bin/ksh
# filename: get.sh
# comments: Not very pretty but functional
# history: 10-01-99, added paging feature
#
# Added note: this file uses the .netrc file stored in the home directory.  See man pages for details.

HOST=remote host name
DIR=/data/Transact/reports/
CONTACT="your email address here"

cd $DIR
ftp -iv $HOST >/tmp/logfile.out 2>&1 <<-EOF
user login password
binary
prompt off
mget file **
bye

EndOfFtp
STATUS=$(grep "transfer complete" logfile.out)
if [ $? -ne 0 ];then
    #( mail errors )
    mailx -s "Error: get ftp script failed" $CONTACT < /dev/null > /dev/null 2>&1
fi