1753781 Members
7572 Online
108799 Solutions
New Discussion юеВ

problem in su

 
Jenny John
Advisor

problem in su

i am running a shell script in hp-ux for export of my database when i su - oracle, it is propmting for password and im running the script from oracle user itself
2 REPLIES 2
Fayez
Trusted Contributor

Re: problem in su

Hi,

This is Linux area, any way it is normal to ask because you are not root user, to work around, try to run it as root user, make the script some thing like this:

export ORACLE_HOME=
export PATH=$PATH:$ORACLE_HOME
su - oracle -c ""

hope it will help
Matti_Kurkela
Honored Contributor

Re: problem in su

Or make your script use su only when necessary, with a test like this:

if [ $(whoami) != "oracle" ]; then
SUPREFIX="su - oracle"
else
SUPREFIX=""
fi

# prefix the command with "su - oracle" if run as someone other than "oracle"
$SUPREFIX somecommand

MK
MK