not able to execute this script ( getting syntax error)


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting not able to execute this script ( getting syntax error)
# 1  
Old 03-16-2010
not able to execute this script ( getting syntax error)

Code:
#!/bin/bash -xv
# hss_backup.sh
#Set the Shared Services Home 
SHARED_SERVICES_HOME=$2
#SHARED_SERVICES_HOME=/app/hyperion/products/Foundation

DESTINATION=$1
#DESTINATION=/home/oracle/backups/HSS_BACKUP
#
# Make sure the ${HYPERION_HOME}/deployments directory is exist
# check fails for WL 8 due to folder structure being different
#
if [ ! -d "${HYPERION_HOME}/deployments" ]; then
   
  echo "ERROR:  ${HYPERION_HOME}/deployments does not exists"
   exit 1
fi
#
# Make sure the ${SHARED_SERVICES_HOME} directory is exist
#
if [ ! -d "${SHARED_SERVICES_HOME}" ]; then
   
  echo "ERROR:  ${SHARED_SERVICES_HOME} does not exists"
   exit 1
fi
 
#
# Creates backup folder if does not exist
#
if [ !  -d "${DESTINATION}" ]; then 
mkdir -p "${DESTINATION}"
fi

#
# slapd.conf file back up
#
if [ -f "${SHARED_SERVICES_HOME}/openLDAP/usr/local/etc/openldap/slapd.conf" ]; then
if [ ! -d "${DESTINATION}/openLDAP" ]; then
mkdir -p "${DESTINATION}/openLDAP"
fi
cp -f "${SHARED_SERVICES_HOME}/openLDAP/usr/local/etc/openldap/slapd.conf" "${DESTINATION}/openLDAP/"
fi
#
#Tomcat conf files back up
#
if [ -d "${HYPERION_HOME}/deployments/Tomcat5/SharedServices9" ]; then
if [ ! -d "${DESTINATION}/Tomcat5" ]; then
mkdir -p "${DESTINATION}/Tomcat5"
fi
cp -f "${HYPERION_HOME}/deployments/Tomcat5/SharedServices9/config/Domain.xml"   "${DESTINATION}/Tomcat5/"
cp -f "${HYPERION_HOME}/deployments/Tomcat5/SharedServices9/config/CSS.xml"    "${DESTINATION}/Tomcat5/"
cp -f "${HYPERION_HOME}/deployments/Tomcat5/SharedServices9/config/slide.properties"   "${DESTINATION}/Tomcat5/"
cp -f "${HYPERION_HOME}/deployments/Tomcat5/SharedServices9/config/WorkflowEngine.properties" "${DESTINATION}/Tomcat5/"
cp -f "${HYPERION_HOME}/deployments/Tomcat5/SharedServices9/config/scheduler.properties"  "${DESTINATION}/Tomcat5/"
cp -f "${HYPERION_HOME}/deployments/Tomcat5/SharedServices9/config/manage_data.properties" "${DESTINATION}/Tomcat5/"
fi
 
#
#Weblogic 9 conf files back up
#
 
if [ -d "${HYPERION_HOME}/deployments/WebLogic9/SharedServices9" ]; then
if [ ! -d "${DESTINATION}/WebLogic9" ]; then
mkdir -p "${DESTINATION}/WebLogic9"
fi
cp -f "${HYPERION_HOME}/deployments/WebLogic9/SharedServices9/config/Domain.xml"   "${DESTINATION}/WebLogic9/"
cp -f "${HYPERION_HOME}/deployments/WebLogic9/SharedServices9/config/CSS.xml"    "${DESTINATION}/WebLogic9/"
cp -f "${HYPERION_HOME}/deployments/WebLogic9/SharedServices9/config/slide.properties"   "${DESTINATION}/WebLogic9/"
cp -f "${HYPERION_HOME}/deployments/WebLogic9/SharedServices9/config/WorkflowEngine.properties"  "${DESTINATION}/WebLogic9/"
cp -f "${HYPERION_HOME}/deployments/WebLogic9/SharedServices9/config/scheduler.properties"  "${DESTINATION}/WebLogic9/"
cp -f "${HYPERION_HOME}/deployments/WebLogic9/SharedServices9/config/manage_data.properties" "${DESTINATION}/WebLogic9/"
fi

#
#WebSphere 6 conf files back up
#

if [ -d "${HYPERION_HOME}/deployments/WebSphere6/SharedServices9" ]; then
if [ ! -d "${DESTINATION}/WebSphere6" ]; then
mkdir -p "${DESTINATION}/WebSphere6"
fi
cp -f "${HYPERION_HOME}/deployments/WebSphere6/SharedServices9/config/Domain.xml"   "${DESTINATION}/WebSphere6/"
cp -f "${HYPERION_HOME}/deployments/WebSphere6/SharedServices9/config/CSS.xml"    "${DESTINATION}/WebSphere6/"
cp -f "${HYPERION_HOME}/deployments/WebSphere6/SharedServices9/config/slide.properties"   "${DESTINATION}/WebSphere6/"
cp -f "${HYPERION_HOME}/deployments/WebSphere6/SharedServices9/config/WorkflowEngine.properties" "${DESTINATION}/WebSphere6/"
cp -f "${HYPERION_HOME}/deployments/WebSphere6/SharedServices9/config/scheduler.properties"  "${DESTINATION}/WebSphere6/"
cp -f "${HYPERION_HOME}/deployments/WebSphere6/SharedServices9/config/manage_data.properties" "${DESTINATION}/WebSphere6/"
fi
#
#Oracle 10 conf files back up
#

if [ -d "${HYPERION_HOME}/deployments/Oracle10g/SharedServices9" ]; then
if [ ! -d "${DESTINATION}/Oracle10g" ]; then
mkdir -p "${DESTINATION}/Oracle10g"
fi
cp -f "${HYPERION_HOME}/deployments/Oracle10g/SharedServices9/config/Domain.xml"   "${DESTINATION}/Oracle10g/"
cp -f "${HYPERION_HOME}/deployments/Oracle10g/SharedServices9/config/CSS.xml"    "${DESTINATION}/Oracle10g/"
cp -f "${HYPERION_HOME}/deployments/Oracle10g/SharedServices9/config/slide.properties"   "${DESTINATION}/Oracle10g/"
cp -f "${HYPERION_HOME}/deployments/Oracle10g/SharedServices9/config/WorkflowEngine.properties" "${DESTINATION}/Oracle10g/"
cp -f "${HYPERION_HOME}/deployments/Oracle10g/SharedServices9/config/scheduler.properties"  "${DESTINATION}/Oracle10g/"
cp -f "${HYPERION_HOME}/deployments/Oracle10g/SharedServices9/config/manage_data.properties" "${DESTINATION}/Oracle10g/"
fi


Last edited by jim mcnamara; 03-16-2010 at 07:00 PM.. Reason: code tags
# 2  
Old 03-16-2010
What error do you get - this code seems to require environment variables be declared and point to real directory trees before it will run. It also requires parameters to set those variables.

DESTINATION
HYPERION_HOME
SHARED_SERVICES_HOME, etc.
# 3  
Old 03-17-2010
Thanks a lot for your response,

sometimes I get command not found, in script only it's working echo, apart from nothing is working, I have tried giving with some prints it's working. But as soon as it's crosses echo and reaches IF, it's saying that command not found.


Thanks
Praveen

---------- Post updated 03-17-10 at 07:48 AM ---------- Previous update was 03-16-10 at 09:43 PM ----------

First script get called from the below script :

Code:
#!/bin/bash -xv
#Set the Shared Services Home 
SHARED_SERVICES_HOME=/app/hyperion/products/Foundation
#Gets the backup folder location as a command line argument
ARGNO=1
if [ $# -lt "$ARGNO" ]; then
echo "ERROR: You must enter a backup folder full path immediately after batch file name"
echo
echo "USAGE: backhp.sh backup_folder"
exit 1
else 
echo " Done "
sh $SHARED_SERVICES_HOME/server/scripts/hss_backup.sh $1 $SHARED_SERVICES_HOME
#sh $SHARED_SERVICES_HOME/server/scripts/runDBArchiveData.sh $1 $SHARED_SERVICES_HOME
fi

i have executed like this :

Code:
backup.sh /home/oracle

after that I am getting error in 1st pasted script ( hss_backup.sh) saying that command not found

and finally it's reached to end of the script and saying that unexpected end of file.

Last edited by pludi; 03-17-2010 at 10:20 AM.. Reason: code tags, please...
# 4  
Old 03-17-2010
I strongly suspect that this is not a unix text file format script file.
These type of errors happen when lines in the script file end with a MSDOS type line terminator (carriage return, line feed) not a unix line terminator (line feed).
It can happen if the file is edited with Microsoft Windows Notepad and copied to a unix server with binary mode FTP. It can happen if the files are downloaded from a website or just picked up from a NTFS mounted volume.

Please check the format of your script files with the following command which just makes the line terminators visible.

Code:
sed -n l scriptname

A bad line will end in \r$
A good line will end in just $

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

Syntax to execute tmadmin command

Could you please help me with the syntax to execute tmadmin command in AIX server? I have a script that works fine in Linux (OEL). Below is the one : tmadmin 2> /dev/null > /tmp/psstat1 <<EOF psr quit EOF I need the corresponding one in AIX. The same command is not working. Tried making... (3 Replies)
Discussion started by: Pandee
3 Replies

2. UNIX for Dummies Questions & Answers

Syntax Error Script

Hi guys i'd like to show you this code of my script, where i couldn't find this error " #! /bin/bash #copiabin.sh: copia todos los archivos ejecutables a bin if then mkdir $HOME/bin fi # copia de archivos y contador N N=0 for ARCH in * do if # Si el archivo es... (9 Replies)
Discussion started by: Newer
9 Replies

3. Shell Programming and Scripting

Cannot execute/finish script because of last line syntax error: unexpected end of file/token `done'

first of all I thought the argument DONE is necessary for all scripts that have or begin with do statements which I have on my script, However, I still don't completely understand why I am receiving an error I tried adding another done argument statement but didn't do any good. I appreciate... (3 Replies)
Discussion started by: wolf@=NK
3 Replies

4. Shell Programming and Scripting

Syntax Error in Script

Hi All, I am new to Unix, I have written the following script in ksh and get a syntax error :wall:. I need some help to figure out the error and reason. The script below uses some variables from an environment file, also it executes a sql file. The sql file is correct and has no problems. I... (1 Reply)
Discussion started by: disshort23
1 Replies

5. Shell Programming and Scripting

Syntax error calling TCL script from shell script

hello everyone i am beginner on shell scripting .and i am working on my project work on ad hoc network i wrote a batch (.sh) to do a looping and execute a tcl script i wrote before in each iteration ..but i got this problem " syntax error near unexpected token `('... (1 Reply)
Discussion started by: marcoss90
1 Replies

6. Shell Programming and Scripting

Syntax error in script

Hey guys keep having problems with the below script syntax error near unpexpected token '0' exit 0 I have two directorys backups and Usr in the usr i have sub dir's wp,ss,pic which i would like to back up (copy those directorys to the backups directory) with user acknowledgement from command line.... (2 Replies)
Discussion started by: Spartukus
2 Replies

7. Shell Programming and Scripting

Syntax error with a script

Hi I not sure what is wrong with my script... when I try to run it I get the follow error: "remove: syntax error at line 77: `end of file' unexpected" Thanks in advance for any help. ans=y while do while : do echo "Please enter a name that you... (3 Replies)
Discussion started by: simpsonjr
3 Replies

8. Shell Programming and Scripting

syntax error on script

Hello all, I am trying to write a little script to create a file and I keep getting the below error and cant see where my syntax mistake(s) is. please help... the script: FILE="/u/e477059/Unix_Machines/LISTS" for X in `cat ${FILE}/list` do ssh $X "echo $X; cd /var/tmp; ... (2 Replies)
Discussion started by: rookieuxixsa
2 Replies

9. UNIX for Dummies Questions & Answers

awk Shell Script error : "Syntax Error : `Split' unexpected

hi there i write one awk script file in shell programing the code is related to dd/mm/yy to month, day year format but i get an error please can anybody help me out in this problem ?????? i give my code here including error awk ` # date-month -- convert mm/dd/yy to month day,... (2 Replies)
Discussion started by: Herry
2 Replies

10. Shell Programming and Scripting

Syntax error in a script...

Hi All, I have been fighting with a syntax error for the last 2 days, still haven't got the solution. Could you please help me, your help will be greatly appreciated. In my script I am getting a error in a for loop, its similar to the one as is below. for v_id in v1 v2 v3 v4 do... (8 Replies)
Discussion started by: rajus19
8 Replies
Login or Register to Ask a Question