- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Script help with " << EOF " errors...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2002 05:01 PM
01-09-2002 05:01 PM
I have written a script to bring up/down oracle databases. I am getting the following error : syntax error "<<" unmatched
Here is the script
#!/bin/ksh
# THIS SCRIPT WILL BE USED TO STARTUP AND SHUTDOWN THE DATABASES
# NOTE: You must supply a start/stop on command line (ie db start)
# - Nitro Microsystems -
ACTION=$1
DATABASE=`/usr/bin/grep oracle /etc/oratab|grep -v "*"|awk '{FS=":"}{print $1}'`
ORA_PATH=`/usr/bin/grep oracle /etc/oratab|grep -v "*"|awk '{FS=":"}{print $2}'|
/usr/bin/head -1`
SVR=/usr/oracle/product/8.0.5/bin/svrmgrl
# ENSURE THAT AN ACTION HAS BEEN GIVEN - IE START OR STOP
if [ -z "${ACTION}" ]
then
echo
echo "You must supply a start or stop command"
echo
echo "USAGE : db.ksh start or db.ksh stop"
echo
exit 1
case $ACTION in
'stop')
for DB in $DATABASE
do
export ORACLE_SID=$DATABASE
export PATH=.:$ORA_PATH/bin:$PATH
$SVR << EOF
connect internal
shutdown immediate
EOF
done
;;
'start')
for DB in $DATABASE
do
export ORACLE_SID=$DATABASE
export PATH=.:$ORA_PATH/bin:$PATH
$SVR << EOF
connect internal
startup
startup
done
;;
*)
echo
echo YOUR START/STOP COMMAND WAS INCORRECT...ensure that it is
echo in lowercase IE: db.ksh start or db.ksh stop
echo
;;
esac
Not sure why this will not work. Thanks for the help,
Sally
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2002 05:07 PM
01-09-2002 05:07 PM
Re: Script help with " << EOF " errors...
blah << EOF
blah
blah
blah
EOF <------ you left this one out on start
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2002 05:14 PM
01-09-2002 05:14 PM
Re: Script help with " << EOF " errors...
Try adding "EOF" before the 'done'in your start section. The stop section has one but not the start.
HTH
-Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2002 05:44 PM
01-09-2002 05:44 PM
Re: Script help with " << EOF " errors...
I just wrote a little test script where I ran:
svrmgrl >> EOF
show all
EOF
and everything was fine. It looks like it doesn't like being in a FOR loop for some reason.
Any more ideas?
Thanks for the help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2002 06:05 PM
01-09-2002 06:05 PM
SolutionBill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2002 06:06 PM
01-09-2002 06:06 PM
Re: Script help with " << EOF " errors...
I'm not an oracle person, but in the attached
link should be something of use.
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x2c268ffa98a2d5118ff10090279cd0f9,00.html
HTH
-Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2002 06:47 PM
01-09-2002 06:47 PM
Re: Script help with " << EOF " errors...
Take a look at this, and possibly other perl solutions:
http://www.tux.org/orac-dba/resources.html
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2002 07:12 PM
01-09-2002 07:12 PM
Re: Script help with " << EOF " errors...
In your response, you quoted a test you performed:
svrmgrl >> EOF
show all
EOF
Another typo? It should be << not >>.
If you are using << correctly and not >>, I agree with Patrick that it is most likely that your EOF is not properly left-aligned in the first column.
Hope this helps. Regards.
Steven Sim Kok Leong
Brainbench MVP for Unix Admin
http://www.brainbench.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2002 07:21 PM
01-09-2002 07:21 PM
Re: Script help with " << EOF " errors...
connect internal
startup
EOF
all have to be left-aligned. I never would have figured that out.
Thanks again,
Sally - sorry for all the typos!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2002 03:39 AM
01-10-2002 03:39 AM
Re: Script help with " << EOF " errors...
$SVR<
means that the input of Oracle Server Manager will be redirected to be from then following text and not from the keyboard, as it is a batch script.
and the end of this input will be notified by the next appearance of the label EOF.
You need :
To close your input text for $SVR<
Greetings.
Magdi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2002 04:48 AM
01-10-2002 04:48 AM
Re: Script help with " << EOF " errors...
the "EOF" *MUST* be left aligned, but if you want the redirected text lines to be indented, you have to prefix the "EOF" mark with a dash:
cat <<-EOF
________is
________shown
________left-aligned
EOF
Since the forums server does not like space, please replace all underscores '-' with spaces ' ' in the above example...
Substitutions still happens within the redirected lines,
but if you not want that you have to single-quote the mark
(i.e. "cat <<'EOF'" or even "cat <-'EOF'")...
HTH,
Wodisch
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2002 06:27 AM
01-10-2002 06:27 AM
Re: Script help with " << EOF " errors...
FYI
Oracle provides standard scripts for this purpose. $ORACLE_HOME/bin/dbshut and $ORACLE_HOME/bin/dbstart
In your start section of the script run dbstart, and in the stop section, run dbshut. The way I look at is, WHY REINVENT THE WHEEL???
Good Luck,
...jcd...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2002 07:06 AM
01-10-2002 07:06 AM
Re: Script help with " << EOF " errors...
Try this example:
echo 'connect internal\nselect * from v$database;\nexit\n' | svrmgrl > /tmp/svrmgrl.out
I have used this in a shell script to determine if an Oracle instance is in archive log mode.
Regards,
Joseph.