[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: how to know if start, restart is successful?



Maria Guarch wrote:
>
> I'm trying to do a webpage like webmin for my project. I just wanted to
> know if the daemons get restarted, started, etc .. when I do it from the
> web. The /usr/sbin/apache2ctl returns the same as the init script... They
> both don't reveal the real status.. Even the result is "pidfile found,
> already running", that returns true. So this is not enough, I'd like to
> know if the start comand did really start the daemon...

It is correct for "start" and "restart" to return true in any case where
the daemon is running at the end of the process.  How it started is
irrelevant.  If you really want to know what the effect of your command
was, you'll need to get more clever about it, perhaps checking for PIDs
yourself, replacing "restart" with "stop" and "start", etc.

There should be several weays you can work around this if you really want
to, but the obvious question is "why bother?".  Most people want "start"
or "restart" to make sure the daemon is running after invocation, not to
respond with "well, I didn't actually have to restart, and I thought I'd
tell you."

... Adam




Reply to: