'end of file' unexpected


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting 'end of file' unexpected
# 1  
Old 04-10-2006
MySQL 'end of file' unexpected

what do u mean by " 'end of file' unexpected "?

i am running a script called "s1" which internally calls "s2"
now s1 starts running & at a point (where it is suppose to call "s2")
i get a message

'end of file' unexpected....
& my script(s) are not working..

any ideas on this?

regards
abhijeet
# 2  
Old 04-10-2006
Care to show us the scripts ?
# 3  
Old 04-10-2006
MySQL

the scenario is like this
i run "cfserver" script which calls "new_orderxml" script
& message i get is

/u02/CFS/bin/new_orderxml.sh:'end of file' unexpected...

here is "cfserver" script
-------------------------------------------------------------------

#####################################################

#CENTRAL FILE SERVER
#PROCESS :: CENTRAL FILE SERVER START SCRIPT

#####################################################

#!/usr/bin/sh
source=/u02/CFS
echo "" > $source/Log/nfs_check
echo "" > $source/Log/nfs_conf

case "$1" in
start)
str="start"
echo ""
mount > $source/Log/nfs_check
share > $source/Log/nfs_check
grep "selectica" $source/Log/nfs_check >> $source/Log/nfs_conf
grep "clarify" $source/Log/nfs_check >> $source/Log/nfs_conf
grep "adc" $source/Log/nfs_check >> $source/Log/nfs_conf
grep "eoms" $source/Log/nfs_check >> $source/Log/nfs_conf
grep "ecom" $source/Log/nfs_check >> $source/Log/nfs_conf
wc -l $source/Log/nfs_conf > $source/Log/count
var=`cut -b 7-9 $source/Log/count`
echo $var
if [ $var -ge 1 ] ;
then
cfs_log="cfs_`date +%d%m%Y`.log"
ps -ef | grep 'sh cfs start' > $source/Log/pid_file
#tput setaf 4
echo "***************************************"
echo "Initialising Central File Server::"
sleep 1
echo "" >> $source/Log/cfs_log.log
echo "********************************************************************************************" >> $source/Log/$cfs_log
echo "" >> $source/Log/$cfs_log
#
echo "CENTRAL FILE SERVER STARTED ON `date`" >> $source/Log/$cfs_log
echo 0 > $source/Log/xmlcount
echo "" >> $source/Log/$cfs_log

echo "********************************************************************************************" >> $source/Log/$cfs_log
# sleep 1
#tput setaf 5
echo "STATUS :: CFS Running"
#tput setaf 4
else
#tput setaf 5
echo "MOUNT POINT ERROR"
#tput setaf 0
exit 0;
fi
echo "Initialising Order XML Transaction::"
xmlcount=0
sleep 1
#tput setaf 5
echo "STATUS :: XML Transaction Running"
#tput setaf 4
echo "Initialising ADC STATUS Transaction::"
sleep 1
#tput setaf 5
echo "STATUS :: ADC Transaction Running"
#tput setaf 4
echo "Initialising CRM STATUS Transaction::"
sleep 1
#tput setaf 5
echo "STATUS :: CRM Transaction Running"
#tput setaf 4
echo "***************************************"
# tput setaf 0
echo ""
while [ "$str" = "start" ] ;
do
sh $source/bin/new_orderxml.sh $source/bin/adc_status.sh
$source/bin/crm_status.sh
#CFS_SERVER
sleep 1
done
;;
stop)
str="stop"
echo "***************************************"
echo "Terminating Order XML Transaction::"
sleep 1
echo "Terminating ADC STATUS Transaction::"
sleep 1
echo "Terminating CRM STATUS Transaction::"
sleep 1
echo "Terminating Central File Server::"
echo "***************************************"
sleep 1
pid_proc=`cat $source/Log/pid_file | grep 'sh cfs start' | cut -b 10-14`
echo "" > $source/Log/pid_file
echo $pid_proc
sleep 1
kill $pid_proc
;;
restart)
$0 stop
sleep 1
nohup cfs start
;;
*)
echo " Usage: cfs { start | stop | restart } "
exit 1
esac
#rm $source/Log/count
-----------------------------------------------------------------------

& here is "new_orderxml" script

#! /usr/bin/ksh
# New order processing script/abhijeet/28-02-2006
# there are two 'for' loops for 'prepaid' & 'postpaid' respectively
# whats new: xmls will NOT traverse sequentially but will be copied to
# respective systems parallely.

source=/u02/CFS

echo "" > $source/Log/ox1
echo "" > $source/Log/ox2
echo "" > $source/Log/ox3
echo "" > $source/Log/ox4
echo "" > $source/Log/name1
echo "" > $source/Log/name2

ls $source/home/selectica/Outbox > $source/Log/ox1
grep "New_Ordr_" $source/Log/ox1 > $source/Log/ox2
grep "_PREPAID.xml" $source/Log/ox2 > $source/Log/ox1

# 'PREPAID' loop starts here..file to be copied only to CRM & OMS.

for file1 in `grep "New_Ordr_" $source/Log/ox1`
do
listfile="Order_PREPAID_`date+%d%m%Y`.lst"
echo $file1 >> $source/Log/$listfile
logfile="Order_PREPAID_`date+%d%m%Y`.log"
echo
"############################################################################################### ###
#################################### >> $source/Log/$logfile

echo "DATE........SYSTEM......STATUS.....FILE NAME.........TIME" >> $source/Log/$logfile

echo $file1 > $source/Log/name1
file2=`cut -b 5- $source/Log/name1`

sys1=SELECTICA
stat1=RECEIVED
echo "`date+%D`...$sys1....$stat1....$file1....`date+%T`" >> $source/Log/$logfile
sleep 2
echo "`date+%D`...IT IS A PREPAID ORDER...`date+%T`" >> $source/Log/$logfile

sys2=CLARIFY
stat2=COPIED
mstat2=RENAMED

cp $source/home/selectica/Outbox/$file1 $source/home/clarify/Inbox/$file1
echo "`date+%D`....$sys2....$stat2....$file1....`date+%T`" >> $source/Log/$logfile
mv $source/home/clarify/Inbox/$file1 $source/home/clarify/Inbox/$file2
chmod 666 $source/home/clarify/Inbox/$file2
echo "`date+%D`....$sys2....$mstat2...$file2...`date+%T`" >> $source/Log/$logfile
sleep 2

mv $source/home/clarify/Inbox/$file2 $source/home/clarify/PArchive/$file2
# file is being copied to CRM..now moving to OMS.

sys3=OMS
stat3=COPIED
mstat3=RENAMED

cp $source/home/selectica/Outbox/$file1 $source/home/oms/Inbox/$file1
echo "`date+%D`...$sys3....$stat3...$file1...`date+%T`" >> $source/Log/$logfile
mv $source/home/oms/Inbox/$file1 $source/home/oms/Inbox/$file2
chmod 666 $source/home/oms/Inbox/$file2
echo "`date+%D`...$sys3....$mstat3....$file2...`date+%T`" >> $source/Log/$logfile
sleep 2

mv $source/home/oms/Inbox/$file2 $source/home/oms/Archive/$file2
# file is being copied to OMS...'PREPAID' loop ends here.

stat0=ARCHIVED
mv $source/home/selectica/Outbox/$file1 $source/home/selectica/Archive/$file2
echo "`date+%D`...$sys1...$stat0...$file1...`date+%T`" >> $source/Log/$logfile
done


# 'POSTPAID' loop starts here

ls $source/home/selectica/Outbox > $source/Log/ox3
grep "New_Ordr_" $source/Log/ox3 > $source/Log/ox4
grep "_POSTPAID.xml" $source/Log/ox4 > $source/Log/ox3

for file3 in `grep "New_Ordr_" $source/Log/ox3`
do
listfile="Order_POSTPAID_`date+%d%m%Y`.lst"
echo $file3 >> $source/Log/$listfile
logfile="Order_POSTPAID_`date+%d%m%Y`.log"
echo "################################################################################"
echo "DATE....SYSTEM...STATUS.....FILE...........TIME " >> $source/Log/$logfile

echo $file3 > $source/Log/name2
file4=`cut -b 5- $source/Log/name2`

sys4=SELECTICA
stat4=RECEIVED

echo "`date+%D`...$sys4...$stat4...$file3...`date+%T`" >> $source/Log/$logfile
sleep 2

echo "`date+%D`....IT IS A POSTPAID ORDER.........." >> $source/Log/$logfile

sys5=ADC
stat5=RECEIVED
mstat5=RENAMED


cp $source/selectica/Outbox/$file3 $source/home/adc/Inbox/$file3
echo "`date+%D`...$sys5...$stat5...$file3....`date+%T`" >> $source/Log/$logfile

mv $source/home/adc/Inbox/$file3 $source/home/adc/Inbox/$file4
chmod 666 $source/home/adc/Inbox/$file4
echo "`date+%D`...$sys5...$mstat5...$file4...`date+%T`" >> $source/Log/$logfile

mv $source/home/adc/Inbox/$file4 $source/home/adc/PArchive/$file4
sleep 5


sys6=CLARIFY
stat6=COPIED
mstat6=RENAMED

cp $source/home/selectica/Outbox/$file3 $source/home/clarify/Inbox/$file3
echo "`date+%D`...$sys6...$stat6...$file3...`date+%T`" >> $source/Log/$logfile

mv $source/home/clarify/Inbox/$file3 $source/home/clarify/Inbox/$file4
chmod 666 $source/home/clarify/Inbox/$file4

echo "`date+%D`...$sys6...$mstat6...$file4....`date+%T`" >> $source/Log/$logfile

mv $source/home/clarify/Inbox/$file4 $source/home/clarify/PArchive/$file4
sleep 2

sys7=OMS
stat7=COPIED
mstat7=RENAMED

cp $source/home/selectica/Outbox/$file3 $source/home/oms/Inbox/$file3
echo "`date+%D`...$sys7...$stat7...$file3....`date+%T` >> $source/Log/$logfile

mv $source/home/oms/Inbox/$file3 $source/home/oms/Inbox/$file4
chmod 666 $source/home/oms/Inbox/$file4

echo "`date+%D`...$sys7...$mstat7...$file4....`date+%T` >> $source/Log/$logfile

mv $source/home/oms/Inbox/$file4 $source/home/oms/Archive/$file4

sleep 2
stat8=ARCHIVED

mv $source/home/selectica/Outbox/$file3 $source/home/selectica/Outbox/$file4
echo "`date+%D`...$sys4...$stat8....$file3....`date+%T`" >> $source/Log/$logfile
done
-------------------------------------------------------------------------




basically i m creating two 'for' loops for "PREPAID" & "POSTPAID" orders..
grepping works but it seems it is not able to enter the "for" loop"

regards
abhijeet
# 4  
Old 04-10-2006
Please check u have closed all thee double quotes for eg u have not in u r xml.sh

echo
"############################################################################################### ###
#################################### >> $source/Log/$logfile

echo "DATE........SYSTEM......STATUS.....FILE NAME.........TIME" >> $source/Log/$logfile

FOr first echo statments.
# 5  
Old 04-10-2006
MySQL

A way to debug the problem is run the script in debug mode using -x

eg ksh -x script

As script is a piece of interpreted code as the execution flows you will be able to located where the problem is.

Regards,
Rishi
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

unexpected end of file

I dont know where I missed the double quotes .:wall:pls review this code and help me out . m1: line 26: unexpected EOF while looking for matching `"' m1: line 34: syntax error: unexpected end of file echo "script is created by prabhu Kumar "; echo "changing the directory to wes... (2 Replies)
Discussion started by: ptappeta
2 Replies

2. Shell Programming and Scripting

Unexpected End Of File Error

Hi guys, I am new to BASH scripting and I was wondering if anyone could have a look at this code and explain to me why I am getting an Unexpected End of File Error ? If you can that would be great / much appreciated! THANKS! #!/bin/bash USER="" PASS="" if ; then echo "You need to set... (1 Reply)
Discussion started by: spooke
1 Replies

3. Shell Programming and Scripting

Unexpected end of file error

Hi , I am new to Unix and this is my first shell script . I am facing "unexpected end of file error" while executing my code . tried removing blank spaces Unable to trace out the error . PLease help !!! #!/bin/sh echo hello if ] echo hi then var=`cat liq_table_nm.txt` ... (6 Replies)
Discussion started by: sen180185
6 Replies

4. Shell Programming and Scripting

Unexpected end of file

Hi, On adding below code to my script shows the error on executing else script works fine. sqlplus $user_name/$password <<EOL truncate table order; commit; truncate table order_hist; commit; insert into order(ID,TRAN,CUST_NAME,OPT_VAL) select * from order_bkp; insert into... (5 Replies)
Discussion started by: milink
5 Replies

5. Shell Programming and Scripting

Unexpected end of file, why?

I am getting a "line 47: syntax error: unexpected end of file", why? According to my estimate, line 47 is 2 lines after the last line of code here. Also, the $1 variable represents the current user logging in, and the script runs with root privileges (This is a Mac OS login hook script using... (5 Replies)
Discussion started by: glev2005
5 Replies

6. Shell Programming and Scripting

unexpected end of file error

hi, i am trying to connect to sqlplus in an 'if block' from the script. it is giving unexpected end of file error. and it works fine if it is out of 'if block'. if anybody have idea on this, can you please help me to solve the error ? piece of code is given below. if then... (11 Replies)
Discussion started by: vinayakatj56
11 Replies

7. Shell Programming and Scripting

'end of file' unexpected

HELP PLEASE!! I am running this script, and i keep getting the error 'end of file' unexpected. I know that usually means parenthesis or whatever is out of place but i cant find anything!! I am new to scripting and i put some "print" staements in and it is not getting past the first IF statment... (7 Replies)
Discussion started by: weatherman0516
7 Replies

8. Shell Programming and Scripting

'end of file' unexpected

HI, I was converting a .bat file to .sh file for unix Code snippet #!/usr/bin/sh set -x if then goto RegularBuild; CURDIR="$1"; cd "$CURDIR"; :RegularBuild echo "Checking for existing fip_help.properties in def/properties directory..." if then rm -f fip_help.properties; ... (1 Reply)
Discussion started by: srisreeku
1 Replies

9. Shell Programming and Scripting

end of file unexpected

hi i have error like this' syntax error end of file unexecpeted.and give me the example of cut command as soon as possible: (1 Reply)
Discussion started by: naveeng.81
1 Replies

10. Shell Programming and Scripting

unexpected end of file

This is the script path=/oracle/ora10gdb/sample archive=/oracle/ora10gdb/archive cd $path for i in `ls`;do mv $i $archive Done Please tell me why it is givind this error (2 Replies)
Discussion started by: dineshr85
2 Replies
Login or Register to Ask a Question

Featured Tech Videos