cancel
Showing results for 
Search instead for 
Did you mean: 

Application Resource starting a process as root

Michael_DeCos1
Level 2
I am running VCS 5.0MP1 Solaris 10.I have an application that I use the Application resource to start, stop, and monitor a process. The problem I have is that the application start script needs to be started as root because it starts up an inetd process. When I use the user root, the process I start is owned by another user. Since I have to start as root, and no matter if I use a PID file or monitor process, it always belongs to a user that is not root. Is there a way I can configure this application resource to start as root, but monitor the process owned by someone else?
1 REPLY 1

Roger_Zimmerman
Level 4
Hi,
 
the user entry inside the agent config is not everytimes succesfull ;-). had and agents are running with userid 0, but not root (this is sometimes not identical).
 
Possible is here: inside your online script you have to start the real start command in a su environment:
 
su - root -c "command arguments"
 
The "su - root" is only possible because had and the agents are runnung in background with user id 0. With every other user environment you would have to provide a password with the "su -" command. (And, no, the password cannot be given with a herescript like everything until <<EOF)
 
Maybe you have to source some environment files too:
 
su  -  root -c ". /.profile; . /etc/<applcationprofile>; command arguments"
 
So inside the online script you change your identification to userid 0 AND the username root and fire your application start command.
 
In simple configurations it is possible to call this ""  su  -  root -c ". /.profile; . /etc/<applcationprofile>; command arguments" "" thing directly from the StartProgram attribute of the application agent. But I remember some issues with the " and ' and shell substitution which i cannot recall :(  Make some tries (remember the \ in VCS is %) there is a way!
 
Good Luck
 
PS: sorry, forgot your question about starting as root and monitoring as someone else: sure you can monitor your application as any user as long as you don't need root rights to carry out the monitoring :-). Application agent is written for such situations. You can run yout online, offline, minitor, clean in any context the app is providing, as long as you don't get in trouble with the operating system rights management. But maybe it is neccessary to be root also for STOPPING the app. Then you have the same procedure again ...


Message Edited by Roger Zimmermann on 11-20-2007 05:27 AM