Operating System - HP-UX
1848539 Members
3737 Online
104033 Solutions
New Discussion

Re: script in rc2.d started by a no-root user

 
muyallo1
Advisor

script in rc2.d started by a no-root user

Hello everybody,

Can I do a script in the rc2.d folder to be run by a no-root user?

I need to start a process owned by a user different than root in the boot of my HP-UX server. Is it possible? I have seen that using the -c option of su command may help, but I find that the command following -c is not run in the shell opened by su (with "-" option), but after it is exited.

Thank you for your answers.
3 REPLIES 3
Mike Shilladay
Esteemed Contributor

Re: script in rc2.d started by a no-root user

Hi,

The su works for us, only you have to use the -c after the user name.

e.g.

/bin/su -c

Mike.
Tim Nelson
Honored Contributor

Re: script in rc2.d started by a no-root user

We also use this all the time for just about any application.

/sbin/init.d/myapp
su - user -c "start_script"
(remember to set the CONTROL_VAR to something also i.e MYAPP )

Link startup control files.
ln -s /sbin/init.d/init.d/myapp /sbin/rc2.d/S900myapp

ln -s /sbin/init.d/myapp /sbin/rc1.d/K900myapp

edit /etc/rc.config.d/myapp
MYAPP=1
Dennis Handly
Acclaimed Contributor

Re: script in rc2.d started by a no-root user

>but I find that the command following -c is not run in the shell opened by su -, but after it is exited.

Why do you think it is "after it is exited"?
When you use "su -", you create a login shell and execute profile and .profile then your command that follows "-c".