![]() |
|
|
|
|
|||||||
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. Shell Script Page. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Getting error "syntax error at line 78 : `<' unmatched" | sshah1001 | Shell Programming and Scripting | 1 | 05-08-2008 02:41 PM |
| "syntax error at line 21 :'done' unexpected." error message" | ibroxy | Shell Programming and Scripting | 3 | 08-08-2007 03:45 AM |
| 0403-057 error `<' is not matched. | ntekupal | Shell Programming and Scripting | 2 | 05-07-2007 08:15 AM |
| 0403-057 Syntax error at line 70. pls help | OMONI | UNIX for Dummies Questions & Answers | 2 | 07-20-2005 01:37 AM |
| getting error 0403-016 Cannot find or open the file while reading a long line | karthee | Shell Programming and Scripting | 2 | 06-04-2005 09:00 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
get_source[34]: 0403-057 Syntax error at line 66 : `"' is not matched.
Hi,
I am getting this error in my shell script, kindly help as soon as possible: ################################################################### # Main body of program ################################################################### . /saptech/scripts/common/declare # Defines variables and all common functions HMSLXFERLOGFILE=/saptech/logs/transferFromHMSL_ppdtest.log exec >> ${HMSLXFERLOGFILE} 2>&1 # Save all output to this log! # Define variables today=`date +%Y%m%d` Script=$0 Severity=${1:-"information"} #remoteSourceDir=${2:-"Download/AP_test/$today*"} remoteSourceDir=${2:-"Download/AP_dev/*"} remoteMoveDir=${3:-"Processed/AP_test"} localIXOSDir=${4:-"/ixos/storm/einvoicing"} IXOSlocalDir=${5:-"/interfaces/eu2/hmsl"} IXOSarchiveDir=${6:-"/interfaces/eu2/hmsl/EBS/$today"} localIXOSsubDir=`basename $remoteSourceDir` # The HMSL Server should be entered in the hosts file with the correct IP address HMSLserver=host_11_A8_webflo # This is the DSA key generated and public key sent to HMSL privateKey=/saptech/scripts/hmsl/EBS/ixoskey sendmail=/usr/sbin/sendmail sshcmd="ssh -l AstraZeneca -i $privateKey $HMSLserver" # ssh options: # l - login as this user on the remote HMSL system # i - key to use to authenticate ourselves to remote HMSL system scpcmd="scp -BCpr -i $privateKey AstraZeneca@$HMSLserver" # scp options: # i - key to use to authenticate ourselves to remote HMSL system # B - Batch Mode = dont ask for passwords # C - Enable Compression # p - Preserve date/times from original files # r - Recursively copy directories # v - Verbose mode = lists files/directories being transferred echo "" echo "--------------------------------------------------------------------" echo "" LogMsg "transferFromHMSL started for EBS" remoteDirPrefix=`$sshcmd pwd` LogMsg "(transferFromHMSL) Attempting Transfer from remote directory $remoteDirPrefix/$remoteSourceDir" LogMsg "(transferFromHMSL) Attempting Transfer to local directory $localIXOSDir/$localIXOSsubDir" LogMsg "(transferFromHMSL) Attempting Transfer to local directory $IXOSarchiveDir/$localIXOSsubDir" #0.5 LogMsg "(transferFromHMSL) 0.5 Move old files to old_fromHmsl folder" # Move files from /ixos/storm/einvoiving to /ixos/storm/old_fromHmsl mv /ixos/storm/einvoicing/* /ixos/storm/old_fromHmsl # Connect to HMSL server and check the directory containing the Invoice data exists # The HMSL server should have the Invoices ready for us in directory $remoteSourceDir, # which is a sub directory of our home directory on their server. echo " ############### for testing purpose.. please remove after testing !! ################" echo "today= $today" echo "remoteSourceDir=$remoteSourceDir" echo "remoteMoveDir=$remoteMoveDir" echo "localIXOSDir=$localIXOSDir" echo "IXOSlocalDir=$IXOSlocalDir" echo "IXOSarchiveDir=$IXOSarchiveDir" echo "############### for testing purpose.. please remove after testing !! ################" # 0.75 # CCL 22 - Check connection and alert Basis if problem - Begin LogMsg "(transferFromHMSL) Connection to HMSL server" $sshcmd ls "~/$remoteSourceDir" > /dev/null rc=$? if [ $rc -ne 0 ] then LogMsg "(transferFromHMSL) TFH070I HMSL server not reachable - Please check" if [ "$Severity" = "information" ] then LogMsg "transferFromHMSL ended with ERRORS" else LogMsg "(transferFromHMSL) Email alert sent to $BASISMAIL" # cat /saptech/scripts/hmsl/email-alerts/tfh070i.connect-failed.msg | $sendmail $BASISMAIL # ErrorOpc $Severity "(transferFromHMSL) TFH070I HMSL server NOT reachable" LogMsg "transferFromHMSL ended with ERRORS" fi exit 0 fi # CCL 22 - Check connection and alert Basis if problem - End LogMsg "(transferFromHMSL) Checking the directory containing the Invoice data exists on the HMSL server" $sshcmd ls "~/$remoteSourceDir" > /dev/null rc=$? if [ $rc -ne 0 ] then LogMsg "(transferFromHMSL) TFH010E Invoice data not available - directory not found on HMSL server" if [ "$Severity" = "information" ] then LogMsg "transferFromHMSL ended with ERRORS" else LogMsg "(transferFromHMSL) Email alert sent to $BASISMAIL" # cat /saptech/scripts/hmsl/email-alerts/tfh010e.no-invoices.msg | $sendmail $IxosNoFile # ErrorOpc $Severity "(transferFromHMSL) TFH010E Invoice data not available - directory not found on HMSL server" LogMsg "transferFromHMSL ended with ERRORS" fi exit 0 fi # Check the number of directories to be transfered remoteDirCount=`$sshcmd ls -l $remoteSourceDir | grep "^d" | tr -s " " | cut -d " " -f 9 | wc -l` LogMsg "remoteDirCount=$remoteDirCount" LogMsg "(transferFromHMSL) Invoice directory on HMSL server found ok - $remoteDirCount directories ready for transfer" echo "" # # Transfer Data from HMSL via secure copy command # LogMsg "(transferFromHMSL) Secure Data transfer starting" echo "" $scpcmd:~/$remoteSourceDir $localIXOSDir rc=$? if [ $rc -ne 0 ] then echo "" LogMsg "(transferFromHMSL) TFH020E Secure Data Transfer failed - Secure Copy Command return code=$rc" if [ "$Severity" = "information" ] then LogMsg "transferFromHMSL ended with ERRORS" else LogMsg "(transferFromHMSL) Email alert sent to $BASISMAIL" # cat /saptech/scripts/hmsl/email-alerts/tfh020e.transfer-failed.msg | $sendmail $BASISMAIL # ErrorOpc $Severity "(transferFromHMSL) TFH020E Secure Data Transfer failed - Secure Copy Command return code=$rc" LogMsg "transferFromHMSL ended with ERRORS" fi exit 0 fi # # Transfer Data from local copy to Italian Archiving Project Directory /interfaces/eu2/hmsl/EBS/$today # LogMsg "(transferFromHMSL) Data transfer to /interfaces/hmsl/EBS starting" echo "" DIR=`basename $remoteSourceDir` #cp -Rp $localIXOSDir/$DIR $IXOSlocalDir mkdir /interfaces/eu2/hmsl/EBS/$today cp -Rp $localIXOSDir/$DIR $IXOSarchiveDir rc=$? if [ $rc -ne 0 ] then LogMsg "(transferFromHMSL) Email alert sent to $BASISMAIL" # cat /saptech/scripts/hmsl/email-alerts/tfh060e.copy-failed.msg | $sendmail $BASISMAIL LogMsg "transferFromHMSL ended with ERRORS" else LogMsg "(transferFromHMSL) Data transfer to /interfaces/eu2/hmsl/EBS/$today completed successfully." fi # # Deleting Invoices data older than 30 days from /interfaces/hmsl/EBS/$today # ####LogMsg "(transferFromHMSL) 30 days old invoice Data deletion from /interfaces/eu2/hmsl/EBS/$today started" #### cd /interfaces/eu2/hmsl/EBS #### find . -type d -mtime +30 -exec rm -r {} \; #### rc=$? #### if [ $rc -ne 0 ] #### then #### LogMsg "(transferFromHMSL) Email alert sent to $BASISMAIL" # cat /saptech/scripts/hmsl/email-alerts/tfh060e.delete-failed.msg | $sendmail $BASISMAIL #### LogMsg "transferFromHMSL ended with ERRORS" ####else #### LogMsg "(transferFromHMSL) Deleting 30 days old documents completed successfully." ####fi # Check number of directories received on local system echo "" localDirCount=`ls -l $localIXOSDir/$localIXOSsubDir | grep "^d" | tr -s " " | cut -d " " -f 9 | wc -l` LogMsg "localDirCount=$localDirCount" if [ $localDirCount -ne $remoteDirCount ] then LogMsg "(transferFromHMSL) TFH030E Warning Data Transfer errror - local and remote directory counts do not match" LogMsg "(transferFromHMSL) Local=$localDirCount Remote=$remoteDirCount" if [ "$Severity" = "information" ] then LogMsg "transferFromHMSL ended with ERRORS" else LogMsg "(transferFromHMSL) Email alert sent to $BASISMAIL" # cat /saptech/scripts/hmsl/email-alerts/tfh030e.dircount-wrong.msg | $sendmail $BASISMAIL # ErrorOpc $Severity "(transferFromHMSL) TFH030E Warning Data Transfer errror-local and remote directory counts do not match" LogMsg "transferFromHMSL ended with ERRORS" fi exit 0 fi # Check number of directories received on local system for Italian Archive project echo "" localDirCount2=`ls -l $IXOSarchiveDir/* | grep "^d" | tr -s " " | cut -d " " -f 9 | wc -l` LogMsg "localDirCount2=$localDirCount2" if [ $localDirCount2 -ne $remoteDirCount ] then LogMsg "(transferFromHMSL) Email alert sent to $BASISMAIL" # cat /saptech/scripts/hmsl/email-alerts/tfh030e.dircount-wrong.msg | $sendmail $BASISMAIL LogMsg "transferFromHMSL ended with ERRORS" fi # ReCheck the number of directories to be transferred incase they changed during the transfer process remoteDirReCount=`$sshcmd ls -l $remoteSourceDir | grep "^d" | tr -s " " | cut -d " " -f 9 | wc -l` LogMsg "remoteDirReCount=$remoteDirReCount" if [ $remoteDirCount -ne $remoteDirReCount ] then LogMsg "(transferFromHMSL) TFH040E Warning Source Directory was updated during Data Transfer" LogMsg "(transferFromHMSL) Original remote directory count=$remoteDirCount" LogMsg "(transferFromHMSL) Current remote directory count=$remoteDirReCount" # ErrorOpc $Severity "(transferFromHMSL) TFH040E Warning Source Directory was updated during Data Transfer" if [ "$Severity" = "information" ] then LogMsg "transferFromHMSL ended with ERRORS" else LogMsg "(transferFromHMSL) Email alert sent to $BASISMAIL" # cat /saptech/scripts/hmsl/email-alerts/tfh040e.sourcedir-changed.msg | $sendmail $BASISMAIL LogMsg "transferFromHMSL ended with ERRORS" fi exit 0 fi LogMsg "(transferFromHMSL) Secure Data Transfer completed ok - $localDirCount directories copied" echo "" # Move remote Invoice directory to the remote "Processed" directory LogMsg "(transferFromHMSL) Moving data to remote 'Processed' directory" echo "" $sshcmd mv $remoteSourceDir $remoteMoveDir rc=$? if [ $rc -ne 0 ] then LogMsg "(transferFromHMSL) TFH050E Error moving remote Invoice Directory to Processed directory $remoteMoveDir" if [ "$Severity" = "information" ] then LogMsg "transferFromHMSL ended with ERRORS" else LogMsg "(transferFromHMSL) Email alert sent to $BASISMAIL" # cat /saptech/scripts/hmsl/email-alerts/tfh050e.move-failed.msg | $sendmail $BASISMAIL # ErrorOpc $Severity "(transferFromHMSL) TFH050E Error moving remote Invoice Directory to Processed directory" LogMsg "transferFromHMSL ended with ERRORS" fi exit 0 fi LogMsg "transferFromHMSL ended OK" LogMsg "Send Success Message to SAP Basis Team Mailbox" echo "TransferFromHMSL for EBS processed $remoteDirCount invoices successfully" | $sendmail $BASISMAIL echo "" # Executing the EXR3 job to enqueue the ftped documents in the pipeline ###echo "" ### Source the IXOS environment so that the EXR3 job is triggered. This is to avoid conflicts with the IXOS scp command and the Secure Shell scp command ###. /usr/ixos-archive/config/setup/profile ###LogMsg "Starting EXR3 job" ###Enqueext -env EXR3_KEY -P 4032 -type EnquedocExR3 ###rc=$? ###if [ $rc -le 9 ] ###then ### LogMsg "Enqueuing jobs in the Document Pipeline failed. Check the Document Pipeline & the EXR3 job log" ###else ### LogMsg "Documents enqueued successfully" ###fi exit 0 |
| Forum Sponsor | ||
|
|
| Thread Tools | |
| Display Modes | |
|
|