Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Software
User Name
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.


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

Rep: Reputation: 0
running scripts as changed user

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... "

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

echo "Starting Oracle Installation..."

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

echo "Prerequisites checking..."



Basically the problem I am facing is the "" script is not getting called at all. Only when I exit from the oracle user, the and anything after that is getting called by the root.
Old 04-07-2004, 06:10 AM   #2
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.

Old 04-07-2004, 11:42 PM   #3
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/ && /path/to/disc1/runInstaller', which would execute runInstaller if evaluates to true. You'd have to check what exit code it generates.


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 10:24 AM
Need help running scripts from scripts sdouble Linux - Newbie 3 05-31-2004 12:56 PM
[apache] running user scripts. yapp Linux - Software 0 10-03-2003 05:00 AM
How can user names be changed? petercool LQ Suggestions & Feedback 4 05-19-2003 08:59 AM
Check if user has changed PW fenriswolf Linux - Security 3 04-29-2003 09:01 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:31 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration