Make your own free website on Tripod.com
SAP Basis Components, Functional and ABAP Programming Books


Unix auto batch file

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

Back to Previous

Return to SAP Hints and Tips on Configuration and ABAP/4 Programming