LinuxQuestions.org
Help answer threads with 0 replies.
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-13-2008, 05:17 AM   #1
sathyguy
Member
 
Registered: Sep 2005
Location: Indian Working in Saudi Arabia
Distribution: Redhat Linux AS 3.0
Posts: 93

Rep: Reputation: 15
added /u02/scripts/startdb.sh in rc.local but not working


Friends,

OS: RHEL AS 3
DB: 9iR2

I created a script startdb.sh to start the oracle database when the system startsup.
the script startdb.sh contains....

Quote:
#!/bin/bash
su - oracle
. $HOME/.bash_profile
sqlplus '/as sysdba' @ /u02/scripts/startup.sql
lsnrctl start
in the rc.local i added the below line at the end.

Quote:
/u02/scripts/startdb.sh
when i reboot the pc to test the script.

its logging in to oracle user but the database is not up the error is

Quote:
-bash: no job control in this shell
what's the mistake i made in the above steps?
note: if i run the script manually as oracle user its working.

thanks & regards

Last edited by sathyguy; 04-13-2008 at 06:05 AM. Reason: missed it
 
Old 04-13-2008, 08:52 AM   #2
prad77
Member
 
Registered: Mar 2008
Posts: 101

Rep: Reputation: 15
Is the path correctly set
try doing 'echo $HOME' and 'which sqlplus' after 'su oracle'

Also if you are able to see your console messages during system boot, then 'set -x' can give some more leads.

Gentoo

Last edited by prad77; 04-17-2008 at 03:46 AM.
 
Old 04-13-2008, 12:45 PM   #3
tiocsti
LQ Newbie
 
Registered: Apr 2008
Location: Atlanta, GA
Distribution: [linux] Ubuntu, [bsd] FreeBSD, NetBSD
Posts: 21

Rep: Reputation: 15
The problem is the way you are doing the su, you can't su to a user and just continue with the script as the new user. Instead, I would propose you do the su in the shell script that calls your startdb script. The -c argument to su can be used to specify the command to run.

Change startdb.sh to be the following:

Code:
#!/bin/bash
. $HOME/.bash_profile
sqlplus '/as sysdba' @ /u02/scripts/startup.sql
lsnrctl start
Inside rc.local, invoke it with the following
Code:
su - oracle -c /u02/scripts/startdb.sh

Last edited by tiocsti; 04-13-2008 at 12:53 PM. Reason: more background on what the problem was
 
Old 04-14-2008, 05:23 AM   #4
sathyguy
Member
 
Registered: Sep 2005
Location: Indian Working in Saudi Arabia
Distribution: Redhat Linux AS 3.0
Posts: 93

Original Poster
Rep: Reputation: 15
Thank you so much....tiocsti
its working fine.....

ok one more thing....
like the above im shutting down the database using crontab

here is the entry in oracle user's crontab
Quote:
20 17 * * * /u03/script/shutdb.sh
i dont have any problem in shutting down the database.

what i need is after shutting down the database, i want to shutdown the server, how can i do that?
 
Old 04-14-2008, 04:30 PM   #5
tiocsti
LQ Newbie
 
Registered: Apr 2008
Location: Atlanta, GA
Distribution: [linux] Ubuntu, [bsd] FreeBSD, NetBSD
Posts: 21

Rep: Reputation: 15
Quote:
Originally Posted by sathyguy View Post
ok one more thing....
like the above im shutting down the database using crontab

here is the entry in oracle user's crontab

i dont have any problem in shutting down the database.

what i need is after shutting down the database, i want to shutdown the server, how can i do that?
Is the server owned by the oracle process? I'm not familiar with oracle, but if it is, you should be able to kill it, or better yet there should be some script that shuts down everything in an orderly fashion. I don't know what that would be, off the top of my head, though.
 
  


Reply

Tags
su


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Yum not working when pidgin.repo is added me4linux Linux - Software 1 08-13-2007 05:44 AM
Added 2nd NIC/Network, now incoming SSH has stopped working dkaplowitz Linux - Networking 2 04-20-2007 08:39 AM
can local packages be added to sources.list? wabbalee Linux - Software 9 02-01-2007 08:30 AM
Added 2nd router - not working tw001_tw Linux - Networking 4 01-30-2005 03:20 PM
Added new DVD drive, old cd stopped working ejennings_98 Linux - Hardware 9 05-22-2004 09:34 PM


All times are GMT -5. The time now is 11:22 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration