Operating System - HP-UX
1753510 Members
5220 Online
108795 Solutions
New Discussion юеВ

Re: Quick question on Service Guard

 
SOLVED
Go to solution
Mike_305
Super Advisor

Quick question on Service Guard

Hello,

I am trying to setup a "start and stop" command as a particular user in service guard "control script" and I need to run this as a specific user.

I know I can put this under "custom define command" but how would I configure this to run as a specific user.

For example:

I want to run samba as user XYZ and I need to put this in one line.

Appreciate your help and thanks in advance.

Thanks
If there is problem then don't think as problem, think as opportunity.
5 REPLIES 5
Jeff Schussele
Honored Contributor
Solution

Re: Quick question on Service Guard

Hi M,

Simply prefix the comand with an su -c "command line"..statement - ie..

su -c username "this is my command"

man su for details.

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Jeff Schussele
Honored Contributor

Re: Quick question on Service Guard

Oops - sorry.

Should be:

su - username -c "command line"

If you drop the "-" then your current shell prevails & the the secondary shell does not kick in.

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Ganesan R
Honored Contributor

Re: Quick question on Service Guard

Hi,

Jeff is correct. In most of the SG environment control script commands will be executed by non-root user (example oracle or some application user). You need to specify like this in control script.

su - oracle -c "/home/oracle/scripts/orastart"
Best wishes,

Ganesh.
Jeff Schussele
Honored Contributor

Re: Quick question on Service Guard

Hee..hee..hee
I just noticed I had it right 1st time.
I'm getting so dang old I guess I question everything I state as fact anymore.
This is fair warning to all U UNIX pups out there.
I was UNIX before UNIX was kewl - your time's coming.

Yucks,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Mike_305
Super Advisor

Re: Quick question on Service Guard

Thanks for your help and quick response. Appreciate your help.
If there is problem then don't think as problem, think as opportunity.