LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-27-2002, 06:12 PM   #1
kalmen
LQ Newbie
 
Registered: Dec 2002
Posts: 9

Rep: Reputation: 0
What's wrong with my script ?


Hi ,

it is regarding about interbase startup script.
I have tried to modify my first script and I can't get it up,
and I have to resolve in starting my interbase server
manually , can anyone help me to check whats wrong with my script below , thanks.

- system always complains - unexpected eof at line ... why?
- what is esac ?
- what is the line ".${INTERBASE:=/usr/interbase/bin}" about ?


{----- script start -----}

#! /bin/sh
# ibserver script - Start/stop the InterBase daemon
# Set these environment variables if and only if they are not set.
. ${INTERBASE:=/usr/interbase/bin}
. ${ISC_USER:=SYSDBA}
. ${ISC_PASSWORD:=masterkey}
# WARNING: in a real-world installation, you should not put the
# SYSDBA password in a publicly-readable file. To protect it:
# chmod 700 ibserver; chown root ibserver
export INTERBASE
export ISC_USER
export ISC_PASSWORD

ibserver_start()
{
# This example assumes the InterBase server is
# being started as UNIX user 'interbase'.
#$INTERBASE/bin/ibmgr -start -forever | su interbase
$INTERBASE/bin/ibmgr -start -forever interbase
}

ibserver_stop()
{
# No need to su, since $ISC_USER and $ISC_PASSWORD validate us.
#$INTERBASE/bin/ibmgr -shut -password $ISC_PASSWORD
$INTERBASE/bin/ibmgr -shut
}

case $1 in
'start' )
echo -e 'InterBase Server starting... c'
ibserver_start ;;
'start_msg' )
echo -e 'InterBase Server starting... c' ;;
'stop' )
echo -e 'InterBase Server stopping... c'
ibserver_stop ;;
'stop_msg' )
echo -e 'InterBase Server stopping... c' ;;
*) echo 'Usage: $0 { start | stop }'; exit 1;;
esac
exit 0

{----- script start -----}
 
Old 12-27-2002, 06:25 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
well i can't see any syntax off hand, but you said you are trying to modify it... well what is it that you've changed?

esac is "case" written backwards, i.e. closing the case block.

and you've not told us which line acutally DOES give that error. why did you remove it???

also, next time, paste code inside a code block, it formats it so much better.
 
Old 12-27-2002, 09:12 PM   #3
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
When troubleshooting shell scripts try to redirect the error output to a file like: "sh -x /some/file.sh 2> /some/error.log". Makes it easier to understand.

unexpected eof at line usually means not closing a block. Could be anything like a missing quote.
.${INTERBASE:=/usr/interbase/bin} means if the environment variable INTERBASE holds no value, assign it the value given after the eq sign. The period in front means "source it". I hope the target is sourceable or is a script or smptin alike, because sourcing isn't the same as "executing" like you do w binaries. Removing the periods before the 3 variable declarations makes it export the vars like it should.
 
Old 12-28-2002, 01:21 AM   #4
kalmen
LQ Newbie
 
Registered: Dec 2002
Posts: 9

Original Poster
Rep: Reputation: 0
Thanks for both your help
I tried 2> ./error.log and I got
./ibserver: line 43:syntax error: unexpected end of file

where line 43 is after my script last line ,
which is
...
exit 0

but AFTER my script "exit 0" there is a remark line
/********************* end of contents *************************/
I don't think is this is the problem, just couldn't figure out whats wrong???

BTW , upSpawn , U mentioned "the target is sourceable or is a script or smptin alike", what do u mean ? my "/usr/interbase/bin"
is a directory .
 
Old 12-28-2002, 06:30 AM   #5
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Kalmen, if you don't know what you're doing (with that script) then what you should have done in the first place was post the whole script, not leaving out parts just like acid_kewpie said. That would have made it easier for ppl to help you troubleshoot this.
Now it just doesn't make no sense.

The "what do u mean ? my "/usr/interbase/bin" is a directory" part shows as well you shouldve provided more info besides that as well.
 
Old 12-28-2002, 09:38 AM   #6
kalmen
LQ Newbie
 
Registered: Dec 2002
Posts: 9

Original Poster
Rep: Reputation: 0
sorry , I am really ,really new in script writing and should provide what ever problems that I am facing , and be really clear in my questions , so I won't aste your time , I'll change this attitude,
ok , back to the problems , I don' understand what do u mean
"the target is sourceable or is a script or smptin alike, " and I think you are refering to "${INTERBASE:=/usr/interbase/bin} " where u said that is it a script or something alike " so I just want to tell U that in my pc , "/usr/interbase/bin" is a directory.

But My problem remain unsolved , I still got the
./ibserver: line 43:syntax error: unexpected end of file ERROR!

UnSpawn ,
Do you know what' wrong?
 
Old 12-28-2002, 07:36 PM   #7
J_Szucs
Senior Member
 
Registered: Nov 2001
Location: Budapest, Hungary
Distribution: SuSE 6.4-11.3, Dsl linux, FreeBSD 4.3-6.2, Mandrake 8.2, Redhat, UHU, Debian Etch
Posts: 1,126

Rep: Reputation: 58
You might use a simple bug tracking technic:
You can locate the source of the error on your own by commenting out or cutting out lines or complete blocks (if...fi, case...esac, functions) until the error disappears.
Meanwhile take care not to produce additional errors and special care to comment out at the first place any commands that can do harm when other parts of the script are removed.

Good luck
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
What is wrong with the following script? lukea37 Programming 4 09-10-2005 09:34 AM
Could someone tell me what's wrong with my shell script please? RowanB Programming 4 11-12-2004 12:17 AM
Whats wrong with this script??? Sammy2ooo Linux - Networking 2 08-24-2004 07:20 AM
What's wrong with my iptables script? veritas Linux - Security 3 06-06-2004 12:39 PM
My first BASH script, what's wrong with it? szf2 Linux - Newbie 2 11-12-2003 02:43 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:50 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration