05-15-2008
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
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi All,
I got a script from one of the unix forums for reporting on filesystem usage and wanted to use it but it keeps giving me the following error.
0403-057 Syntax error at line 70
The script is shown below.
Pls help as I am new to UNIX.
# set -x
# D I S K S P A C E . S H
#
#... (2 Replies)
Discussion started by: OMONI
2 Replies
2. Shell Programming and Scripting
Hi Everybody,
I am new to this group and also to the Unix shell scripting.
I need some one to throw some light on this issue. I am not sure whats wrong in this script.When I execute this korn shell script it gives me an error
0403-057 Syntax error at line 28 : `<' is not matched.
... (2 Replies)
Discussion started by: ntekupal
2 Replies
3. Shell Programming and Scripting
Can someone please tell me wht is wrong with the following peice of code?
I keep getting the following error -
0403-057 Syntax error at line 52 : `)' is not expected.
case "${option_count}" in
1) java -Xms256m -Xmx1536m "${APPLNAME}" "${ACTION_TYPE}" > "${LOGFILE}" 2>... (2 Replies)
Discussion started by: Veenak15
2 Replies
4. Shell Programming and Scripting
Hi All
I am quite new to Unix. Following is a shell script that i have written and getting the subject mentioned error.
#!/bin/ksh
#-------------------------------------------------------------------------
# File: ang_stdnld.ksh
#
# Desc: UNIX shell script to extract Store information.... (3 Replies)
Discussion started by: amitsinha
3 Replies
5. Shell Programming and Scripting
curr_time=`date +%Y%m%d%H%M`
curr_date=`date +%Y%m%d`
zero=0
script_path="/home/wccuser1/wcc/Scripts/bulk_file_ftp"
file_dir="/home/wccuser1/wcc/Bulk_Files"
todays_file_count=`ls -ltr | grep $curr_date | awk '{print $9}' | wc -l`
todays_file=`ls -ltr | grep $curr_date | awk '{print $9}'`
if... (5 Replies)
Discussion started by: gagandeep
5 Replies
6. Shell Programming and Scripting
Hi,
I am getting this error in my attached shell script, kindly help as soon as possible:
Thanks,
Andre (2 Replies)
Discussion started by: damoon
2 Replies
7. Shell Programming and Scripting
i dont know where m i mistaking.. please help me out with this issue :(
thanks in advance:rolleyes:
one_main()
{
a=100
while ;
do
clear
echo "##############################################"
echo ":: CURRENTLY YOU ARE IN RC AND OC MARKING ::"
echo... (1 Reply)
Discussion started by: Puneet sinha
1 Replies
8. AIX
Hi,
I am new to shell scripting.i am trying to mail after my backup completed.
Here is my shell script:
if ; then
egrep (ERROR|error|Error|RMAN-) ${/backup/RMANBKUP/spool/shelltest.log} > /dev/null
if ; then
RESULT_MSG=WARNING: Errors occurred during the ${ORACLE_SID} Rman... (3 Replies)
Discussion started by: faruqms
3 Replies
9. Shell Programming and Scripting
Hi,
While executing my code i am getting below Error:
./check_disk1: 0403-057 Syntax error at line 55 : `(' is not expected.
My code is :
#!/bin/ksh
PROGNAME=`basename $0`
STATE_OK=0
STATE_WARNING=1
STATE_CRITICAL=2
STATE_UNKNOWN=3
OS=$(uname)
AWK="/usr/bin/awk"... (6 Replies)
Discussion started by: abodage
6 Replies
10. Shell Programming and Scripting
Hi Everyone,
I am getting strange behavior, same script runs fine without any error in one AIX machine, whereas on another it is throwing this error "0403-057 Syntax error at line 399 : `"' is not matched", I also ran the script in debug mode.
This is the output, still doesn't say anything.... (2 Replies)
Discussion started by: sid1987
2 Replies