Creating a Unix auto batch file to auto ftp SAP files

You can type autounix YYYYMMDD at the unix command prompt to auto zip the 3 files at the required date.

autounix.sh

#!/bin/ksh

# Declaring all the variables
s_filepath='/sap/usr/sap/trans/data/'
s_backuppath='/sap/usr/sap/trans/data/autozip/'
s_unixfile1=$s_filepath'FILE1'
s_unixfile2=$s_filepath'FILE2'
s_unixfile3=$s_filepath'FILE3'
 

# This has been changed to accepting parameter pass in as date
#s_date=`date '+%Y%m%d'`
s_date=$1
s_filename='SAP.'$s_date'.ZIP'
s_donefilename=$s_filename'.DONE'

# Execute the zip command

/usr/local/bin/pkzip -add -pass=test123 $s_backuppath$s_filename $s_unixfile1 $s_unixfile2 $s_unixfile3

# Execute the FTP transfer
user='ftp'
passwd='ftp1234'
destdir='data/test'

cd $s_backuppath
ftp -in ftp-out.sapservx.com << EndHere
   user $user $passwd
   cd $destdir
   bin
   put $s_filename
   rename $s_filename $s_donefilename
   quit
EndHere

SAP Basis Reference Books:
SAP Basis Components, System Administration, Security, ALE and iDoc Books

Back to Basis Menu:
SAP BC (Basis Components) Hints and Tips

Return to :-
SAP ABAP/4 Programming, Basis Administration, Configuration Hints and Tips

(c) www.gotothings.com All material on this site is Copyright.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
All product names are trademarks of their respective companies.  The site www.gotothings.com is in no way affiliated with SAP AG.
Any unauthorised copying or mirroring is prohibited.