|
Home > Archive > Unix administration > August 2006 > how to make su work in daemon
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
how to make su work in daemon
|
|
| john_woo@canada.com 2006-07-31, 7:19 pm |
| Hi,
I have a daemon script, in that there is
su john "/path/his_script"
without using "su john", it all works, but having it, the script is not
executed when system rebooted, but after system started up, it can be
run as
service the_daemon start
Can any one tell how to use "su" in daemon?
--
Thanks
John
Toronto
| |
| Kevin Collins 2006-08-02, 7:22 pm |
| In article <1154373242.536093.322200@75g2000cwc.googlegroups.com>,
john_woo@canada.com wrote:
> Hi,
>
> I have a daemon script, in that there is
>
> su john "/path/his_script"
This should be:
su john -c "/path/his_script"
> without using "su john", it all works, but having it, the script is not
> executed when system rebooted, but after system started up, it can be
> run as
Do you have the appropriate run-level links to the script? Since you mention
the "service" command below, I assume you are using Linux? Try "chkconf --list
the_daemon" - what does it tell you?
> service the_daemon start
>
> Can any one tell how to use "su" in daemon?
Does your process "/path/his_script" return or put itself in the background? If
not, you risk hanging the boot process.
Kevin
--
Unix Guy Consulting, LLC
Unix and Linux Automation, Shell, PERL and CGI scripting
http://www.unix-guy.com
| |
| john_woo@canada.com 2006-08-04, 1:39 pm |
|
Kevin Collins wrote:
> In article <1154373242.536093.322200@75g2000cwc.googlegroups.com>,
> john_woo@canada.com wrote:
>
> This should be:
>
> su john -c "/path/his_script"
>
>
> Do you have the appropriate run-level links to the script? Since you mention
> the "service" command below, I assume you are using Linux? Try "chkconf --list
> the_daemon" - what does it tell you?
>
>
> Does your process "/path/his_script" return or put itself in the background? If
> not, you risk hanging the boot process.
>
> Kevin
Thanks lots, Kevin.
It should be like su -l john -c "..."
but the tough question is, in this service daemon script, it involves
either
stop service, or kill the on-running-process, which the user john
doesn't have kill and service operation.
Can you tell, how to make it work around ?
Thanks
John
| |
| Kevin Collins 2006-08-08, 7:21 pm |
| In article <1154702208.177109.3900@b28g2000cwb.googlegroups.com>, john_woo@canada.com wrote:
>
> Kevin Collins wrote:
>
> Thanks lots, Kevin.
>
> It should be like su -l john -c "..."
>
> but the tough question is, in this service daemon script, it involves
> either
>
> stop service, or kill the on-running-process, which the user john
> doesn't have kill and service operation.
>
> Can you tell, how to make it work around ?
John,
your startup script is running as root. Why are you using su to change to
"john" if "john" can't do what needs to be done? This makes no sense to me...
If you can clearly explain the process of what you want to happen, somebody
here should be able to help.
Kevin
--
Unix Guy Consulting, LLC
Unix and Linux Automation, Shell, PERL and CGI scripting
http://www.unix-guy.com
| |
| john_woo@canada.com 2006-08-12, 1:29 pm |
|
Kevin Collins wrote:
> In article <1154702208.177109.3900@b28g2000cwb.googlegroups.com>, john_woo@canada.com wrote:
>
> John,
>
> your startup script is running as root. Why are you using su to change to
> "john" if "john" can't do what needs to be done? This makes no sense to me...
> If you can clearly explain the process of what you want to happen, somebody
> here should be able to help.
>
Hi Kevin,
One of the client of the system, wants to auto-start their app whenever
system reboot, and wants to control their app, like restart, stop,...,
the point is, if the app started under root, then the app writes to
files which belong to root as well, also the restart command use "kill"
to stop the running app.
that's what I stuck.
John
|
|
|
|
|