Tuesday, July 8, 2008

FTP from AIX to Windows

#!/bin/sh
export FPFT="/prod_appl/prod11i/prod11iappl/pa/11.5.0/log"
cd $FPFT
export FPFTL="$FPFT/ftp_output1"
ftp -n 111.222.333.444 < $FPFTL
user unixuser unixuserpass
cd /VOL1/pub/winapps/TIMESHEET
binary
put prcodes.csv
or
put /prod_appl/prod11i/prod11iappl/pa/11.5.0/log/prcodes.csv /VOL1/pub/winapps/TIMESHEET/prcodes.csv
quit
EOT
# ============================================================================
# Verify the transfer completed. Notify someone if it fails.
# ============================================================================

tail -1 $FPFTL | read RC

tail -5 $FPFTL | grep '501' | wc -l | read RC2
tail -5 $FPFTL | grep '552' | wc -l | read RC3

if [ $RC2 -gt 0 -o $RC3 -gt 0 ]
then
mailx -s "TIME_SHEET ftp from ors0 to mcinw1 failed" ramasamyl@scrra.net < $FPFTL
exit 1;
elif test "$RC" = "Not connected."
then
mailx -s "TIME_SHEET ftp from ors0 to mcinw1 failed" ramasamyl@scrra.net < $FPFTL
exit 1;
else
echo $REXCDE
fi

exit
exit 0

#!/bin/sh
cd /home/user
ftp -n 111.222.333.444 < logfile
quote user unixuser
quote pass unixuserpass
binary
cd C:/TEST
put test.txt
quit
EOT
exit 0