httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yann Ylavic <ylavic....@gmail.com>
Subject Re: [users@httpd] apache run status: how to tell as non-root user (on *nix)?
Date Tue, 21 Feb 2017 14:53:06 GMT
On Tue, Feb 21, 2017 at 3:19 PM, Rainer Canavan
<rainer.canavan@sevenval.com> wrote:
> On Tue, Feb 21, 2017 at 2:53 PM, Tom Browder <tom.browder@gmail.com> wrote:
>> I need to programatically determine whether httpd is running or not, whether
>> I'm root or not. The only reliable way I have found is to use the system
>> command 'ps -C httpd' and grep the results.
>>
>> Is there a better way?
>
>
> If you know where the .pid file is, you can read that and check if the
> process is
> running, e.g. via ps --pid `cat /var/run/apache2.pid`

Or:
    kill -0 `cat /var/run/apache2.pid`

which is likely "lighter".


Regards,
Yann.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message