The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. Shell Script Page.

More UNIX and Linux Forum Topics You Might Find Helpful
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

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-15-2008
Registered User
 

Join Date: May 2007
Posts: 23
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
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
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 05-15-2008
era era is online now
Herder of Useless Cats
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 2,252
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
I'm sorry, it's not realistic for somebody to debug that just by looking at it. Which line is line 66?
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes


The 50 most popular UNIX and Linux searches.
Google Search Cloud for The UNIX and Linux Forums
421 service not available, remote server has closed connection ^m automate ftp autosys awk trim bash eval bash exec bash for loop command copy/move folder in unix couldn't set locale correctly curses.h cut command in unix export command in unix find grep find mtime find null character in a unix file grep multiple lines grep or grep recursive hp-ux ifconfig inaddr_any inappropriate ioctl for device lynx javascript mailx attachment mget mtime ping port remove first character from string in k shell replace space by comma , perl script rsync ftp scp recursive segmentation fault(coredump) sftp script snoop unix solaris change ip address stale nfs file handle syn_sent tar exclude tar extract to folder test: argument expected unix unix .profile unix forum unix forums unix internals unix mtime unix simulator unix.com vi substitute while loop within while loop shell script


All times are GMT -7. The time now is 03:49 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101