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 > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Executing script with root privilages from a user login checkpro SCO 1 03-11-2008 06:03 PM
Shell script to find when user su'ed to root jrvilino Shell Programming and Scripting 1 03-05-2008 10:31 AM
switching user from root to ordinary user sasia Shell Programming and Scripting 3 01-25-2008 10:25 PM
Other than root user .Normal user is unable to create files mallesh UNIX for Advanced & Expert Users 1 06-22-2005 12:18 PM
crontab and shell script that executes a sql. radhika Shell Programming and Scripting 6 06-06-2005 11:33 PM

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 05-17-2005
tads98 tads98 is offline
Registered User
  
 

Join Date: May 2005
Posts: 40
root executes a script as another user

we have this script that stops, starts and monitor process scheduler. prcs_control. this script runs perfectly when executed by ps_user.

we are now creating a new script that will run this script and is executed by root. this script needs to execute the prcs_control as ps_user because root can not execute the psadmin command.

here's how we coded it to be executed by ps_user

su -c "path/prcs_control arg1 arg2"

the script exits successfully but when the status process sched is checked via manual psadmin, it did not stop or start the process sched.

any idea?
  #2 (permalink)  
Old 05-17-2005
RTM's Avatar
RTM RTM is offline Forum Advisor  
Hog Hunter
  
 

Join Date: Apr 2002
Location: On my motorcycle
Posts: 3,039
If the script is run by root, then your su command needs to be
su - ps_user -c "path/prcs_control arg1 arg2"

If the script is being run by ps_user, then you may need to source the .profile or .login (it matters what the shell is) to set up environment variables.
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 07:15 PM.


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