The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Trouble with awk RichieFondel Shell Programming and Scripting 1 01-17-2008 07:30 AM
X trouble izua UNIX for Dummies Questions & Answers 0 01-03-2007 06:19 PM
Trouble with tr Mike@Work SUN Solaris 8 08-10-2006 03:04 PM
The trouble with... zazzybob What's on Your Mind? 6 01-18-2005 06:01 AM
trouble awk UNIX Desktop for Dummies Questions & Answers 1 11-22-2002 10:51 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-05-2005
nulnul7 nulnul7 is offline
Registered User
  
 

Join Date: Nov 2004
Location: France
Posts: 9
Question The trouble about SU ...

Hi all,

having read lots of posts about SU I don't quiet understand this :

I'm doing regular backups of my database (u betta do) and therefore use su - username -c "sqlscript special data_base" in a unixscript which is even using cron. (yep!)

Now I need some other script, still with this database, to do some updates to it, nightly.

Manually, I can run the usual command (being root) as above but the problem is that I can't get out of it unless keying exit in. Even keying exit between the quotes doesn't work.

When keying exit in at commandline, I get back to my root-shell and the script is launched correctly.

Any idea would be greatfully accepted!
  #2 (permalink)  
Old 10-05-2005
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,715
Please show us an example of the command that does not work in your script.
  #3 (permalink)  
Old 10-05-2005
nulnul7 nulnul7 is offline
Registered User
  
 

Join Date: Nov 2004
Location: France
Posts: 9
Ok, there you go :

As root.

su - dbuser -c "customers.exe upd_prclst"

or

su - dbuser -c "customers.exe upd_prclst;exit"

is putting me into a new shell as user dbuser.

This user then has full access to all of his environment but the prog customers.exe upd_prclst is not ran.

I then key in an exit command which puts me back to the root environment. The prog is executed ok in the dbuser shell.

I suppose there must be a CTRL-D or something missing but
  #4 (permalink)  
Old 10-05-2005
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,111
Look carefully at dbuser's .profile or other startup script. Does he exec a new shell or something?
  #5 (permalink)  
Old 10-05-2005
nulnul7 nulnul7 is offline
Registered User
  
 

Join Date: Nov 2004
Location: France
Posts: 9
Ahhhaahh !!!

You are right!

Why this has been done this way ... dunno but in fact, the .profile is executing another script which is executing ksh -o vi at the end of it.
I don't know yet wheather this is important or not but I made a copy of the user and deleted the ksh command.

It works ok now.

Great!

Thanks a lot!

Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:12 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0