Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing the userid

Status
Not open for further replies.

tatead

MIS
Jul 11, 2002
6
US
I am writing a script that will shutdown my database, backup the system and then restart my database. This script needs to be run out of root's cron. I need to start my database as a certain user. On most of my systems I do this by doing a su - {userid} and then run the startup script. On one system the vendor written script to start the database does a 'who -m | read {userid}'. Unfortunately, the database will not start when the results come back as root. Does anyone know how I can fool the userid results to show a particular user?

My line of code is:
su - joe '-c /home/joe/startdb'

 
this should work

su - joe -c "/home/joe/startdb
 
Hi,

In the Vendor script, Replace the instruction below
Code:
who -m | read {userid}

by this one :

Code:
print $LOGIN | read {userid}
# or by this one
userid=$LOGIN

 
Thanks. I went ahead and changed the vendor script from who -m to print $LOGIN.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top