- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- How to Su to Oracle, execute command and exit in a...
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
Discussions
Discussions
Discussions
Forums
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
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
тАО09-18-2000 08:30 AM
тАО09-18-2000 08:30 AM
I have tried within a 3 line script to do the following:-
su - oracle
pwd
exit
While executing the script the first line suceeds, as it will su into oracle but the does not execute the pwd command and exit.
If I do this through the command line manually it works. For some reason if you execute these three lines in a simple script it will stop after the first line.
Any ideas???
Thanks for your help.
Shaun Aldrich
SAldrich@chaptersinc.com
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-18-2000 08:34 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-18-2000 08:34 AM
тАО09-18-2000 08:34 AM
Re: How to Su to Oracle, execute command and exit in a script?
You cannot provide the password to the su within the script. You will always be prompted interactively.
If you are root, you can write:
# su - oracle -c
This will run
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-18-2000 08:37 AM
тАО09-18-2000 08:37 AM
Re: How to Su to Oracle, execute command and exit in a script?
If you simply go su - oracle you now log in as oracle, it wont run the last 2 lines of your script until you do an exit command. The - sign means actually log in as that user. Not what you want for a script unless you add the -c option.
I think what you really want to do is either;
1. su - oracle - c "
2. su oracle
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-18-2000 08:37 AM
тАО09-18-2000 08:37 AM
Re: How to Su to Oracle, execute command and exit in a script?
su - oracle <
exit
EOD