What exactly is a Deamon ? ( how to run a root command from apache binded script that uses www-data user )?
Posted
by
user224235
on Server Fault
See other posts from Server Fault
or by user224235
Published on 2014-06-07T08:58:56Z
Indexed on
2014/06/07
9:27 UTC
Read the original article
Hit count: 250
I am trying to run this command from WSGI script
service httpd restart
The problem is this command can only be run by root
and apache uses the www-data user.
it has been said the solution is to use a
Deamon Process
i suppose the idea is to send the command to a file
that will be executed by a script that is considered "root" user..
its difficult to understand why they would call this a Deamon Process
and try to scare me.
Perhaps it should have been called : proxy process
when i got the idea that this was a proxy process..
i thought about adding a line to
/var/spool/cron/root
that way the cron would execute the command for me.
but of course this means i have to get the system time
and then add 1 second to it and then add it to that line
so cron would execute the command for me as root
but my script demands an output instantly.
so i suppose i need to create a DEAMON PROCESS
that works like the cron.
in other words it is a bash file that will execute the command in a plain file..
but will this DEAMON PROCESS be running a while command 24/7 every second ?
would that not waste resources ?
it only needs to activate itself to check for a command to execute
when there is a command to be executed.
i mean in PHP and other programming languages.. running a
while
statement when there is nothing to be executed could waste
resources of the server..
so why should a deamon process constantly be listening for anything.
i only want it to listen and execute when it is needed.
i do not need a process that is constantly listening.
© Server Fault or respective owner