Auto ftp

Parameters are:
1 - Filename
2 - Destination
3 - Suffix for the log file
4 - Destination for the event if session fails
5 - Instance for the event if session fails

#!/bin/sh

RMTHOST=`echo $2 | tr '[A-Z]' '[a-z]'`
ftp -v $RMTHOST << EOJ > /OUTBOUND/autoftp.$3 2>&1
lcd /OUTBOUND
put $1
bye
EOJ
grep -q "Transfer complete." /OUTBOUND/autoftp.$3
if [ $? -eq 0 ]
then
rm /OUTBOUND/$1 >> /OUTBOUND/autoftp.$3 2>&1
rexec $RMTHOST uname -n >> /OUTBOUND/autoftp.$3 2>&1
rexec $RMTHOST date >> /OUTBOUND/autoftp.$3 2>&1
else
/sapmnt/$4/exe/sapevt Z_CANCEL -t -p /OUTBOUND/'$1' NAME=$4 NR=$5 >>
/OUTBOUND/autoftp.$3 2>&1
fi

Create (and secure as much as is possible) a .netrc file in <sid>adm's
home directory for automatic logon information or even worse put it in
the script.

Best regards,
SAP Basis, ABAP Programming and Other IMG Stuff
http://www.erpgreat.com

All the site contents are Copyright © www.erpgreat.com and the content authors. All rights reserved.
All product names are trademarks of their respective companies.  The site www.erpgreat.com is in no way affiliated with SAP AG.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
 The content on this site may not be reproduced or redistributed without the express written permission of
www.erpgreat.com or the content authors.