LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-07-2004, 04:52 AM   #1
rammya
LQ Newbie
 
Registered: Apr 2004
Posts: 5

Rep: Reputation: 0
running scripts as changed user


Hi,
I am trying to write a script which will check all dependencies and do a silent Oracle install...

The program will be called by "root". This is part of the program:

echo "Setting Environment variables... "

./envvar.sh ----> should be performed as "root"

echo "Starting Oracle Installation..."

su - oracle ---> the scripts after this should be performed as oracle user

echo "Prerequisites checking..."

./check.sh

/disc1/runInstaller

Basically the problem I am facing is the "check.sh" script is not getting called at all. Only when I exit from the oracle user, the check.sh and anything after that is getting called by the root.
 
Old 04-07-2004, 07:10 AM   #2
hw-tph
Senior Member
 
Registered: Sep 2003
Location: Sweden
Distribution: Debian
Posts: 3,032

Rep: Reputation: 58
Welcome to LQ.

The oracle user isn't running the script. When you su to the oracle user you basically start a new shell as that user, and your original bash (as run by root) will wait until this shell exits to continue.

You may want to consider using expect instead of bash for the whole script, or at least for parts of it. Expect comes with a script that automates generating expect-scripts, very nifty indeed.


Håkan
 
Old 04-08-2004, 12:42 AM   #3
lnxconvrt
Member
 
Registered: Mar 2002
Location: Houston
Distribution: FC3, Manrake 10.x, various others at times
Posts: 113

Rep: Reputation: 18
hw-tph nailed it, as far as what's happening. I haven't used expect, tho I'd like to explore it some time.

Another option is to do something like this:

su - oracle -c '/path/to/check.sh && /path/to/disc1/runInstaller', which would execute runInstaller if check.sh evaluates to true. You'd have to check what exit code it generates.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Running Scripts at User Login? Setheck Linux - Software 6 09-27-2004 11:24 AM
Need help running scripts from scripts sdouble Linux - Newbie 3 05-31-2004 01:56 PM
[apache] running user scripts. yapp Linux - Software 0 10-03-2003 06:00 AM
How can user names be changed? petercool LQ Suggestions & Feedback 4 05-19-2003 09:59 AM
Check if user has changed PW fenriswolf Linux - Security 3 04-29-2003 10:01 PM


All times are GMT -5. The time now is 12:46 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration