LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-18-2009, 03:36 AM   #1
priyankarathi
LQ Newbie
 
Registered: Apr 2009
Posts: 4

Rep: Reputation: 0
Sntax error : unexpected end of file while executing shell script


hello

Posting for first time
Actually I have written a shell script to take RMAN backup..
But when I execut it I get an error as

"syntax error: unexpected end of file"

Script:

if [ -n $1 ]; then
echo $1
backup=$1
fi

if [ $1="full" ]; then
rman target / <<ST
run {
allocate channel ch0 type sbt_tape;
backup full database;
release channel ch0;
}
ST
echo backup completed
fi


Can someone please help me out..
Actually m new at shell scripting
 
Old 04-18-2009, 04:14 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

I'm not familiar with rman (we are talking about Oracle's Recovery Manager aren't we?), but a quick search tells me that your syntax is not correct. You don't need the run { } syntax (untested, don't have rman present):
Code:
.
.
.
then
  rman target / <<ST
  allocate channel ch0 type sbt_tape;
  backup full database;
  release channel ch0;
ST
.
.
.
Take a look here: An Introduction to Linux Shell Scripting for DBAs

And here for a different approach: RMAN command from script

Hope this helps.
 
Old 04-19-2009, 11:05 PM   #3
priyankarathi
LQ Newbie
 
Registered: Apr 2009
Posts: 4

Original Poster
Rep: Reputation: 0
Hello,

You r right ..RMAN is recovery manager
Thanks for the reply..
But i had alraedy tried it...
Its not working..

Can somebaody help me
 
Old 04-20-2009, 02:18 AM   #4
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi again,

What did you try? My suggestion and the tips/hints/examples in the provided links? And none work?

What are the errors do you encounter and if at all possible could you post the entire script.
 
Old 04-20-2009, 02:50 AM   #5
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
One of the most common errors is the indentation of the string at the end of the here documents:
Code:
rman target / <<ST
run {
allocate channel ch0 type sbt_tape;
backup full database;
release channel ch0;
}
ST  ### This must be at the beginning of the line
 
Old 04-21-2009, 01:33 AM   #6
priyankarathi
LQ Newbie
 
Registered: Apr 2009
Posts: 4

Original Poster
Rep: Reputation: 0
Heyy!!!!

Actually the problem was not with the script...
Actually I was doing indentation for RMAN script when called in function..
i.e

funbackup ()
{
rman target / <<ST
backup....
....
}

Actually it shud be
funbackup ()
{
rman target / <<ST
backup....
....
}

this was creating problemmm
But i solved it by trial and error..
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bash script - syntax error: unexpected end of file Mr Pink Programming 7 12-19-2008 06:31 AM
Backup Script error "line 31: syntax error: unexpected end of file" eswanepoel General 7 12-07-2007 09:28 AM
bash "unexpected end of file" script error Runge_Kutta Linux - General 6 05-23-2007 03:36 PM
Sntax error at the end of input mihireng Programming 2 07-07-2006 10:45 AM
got a syntax error which shows unexpected end of line when tried to run a shell scrip racer_mec Linux - Newbie 1 01-10-2005 01:43 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:08 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