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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
12-27-2002, 06:12 PM
|
#1
|
LQ Newbie
Registered: Dec 2002
Posts: 9
Rep:
|
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 -----}
|
|
|
12-27-2002, 06:25 PM
|
#2
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417
|
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.
|
|
|
12-27-2002, 09:12 PM
|
#3
|
Moderator
Registered: May 2001
Posts: 29,415
|
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.
|
|
|
12-28-2002, 01:21 AM
|
#4
|
LQ Newbie
Registered: Dec 2002
Posts: 9
Original Poster
Rep:
|
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 .
|
|
|
12-28-2002, 06:30 AM
|
#5
|
Moderator
Registered: May 2001
Posts: 29,415
|
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.
|
|
|
12-28-2002, 09:38 AM
|
#6
|
LQ Newbie
Registered: Dec 2002
Posts: 9
Original Poster
Rep:
|
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?
|
|
|
12-28-2002, 07:36 PM
|
#7
|
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:
|
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
|
|
|
All times are GMT -5. The time now is 06:50 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|