Re: how to know if start, restart is successful?
Hi HTH Ralf Mattes
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...
Thanks in advance.
P.D:I'm sorry for my english
On 4/27/05, email@example.com <firstname.lastname@example.org> wrote:
> On Wed, Apr 27, 2005 at 11:14:57AM +0200, Maria Guarch wrote:
> > Hello !!
> > I'd need to know if
> > /etc/init.d/* start/restart or stop
> > is successful or not..
> > I've done that
> > if /etc/init.d/apache2 start;then
> > echo yes
> > else
> > echo no
> > fi
> > But it returns yes even it can not be started...is there any way to
> > know if restarting daemons is successful?
> Maria, that really depends on how you define "success". Initscripts usually
> are made to not block, otherwise the boot process might hang for an unreasonable
> time. So, do you use a (modified) version of the init program that needs to check
> for the success of the script?
> The init.d script _does_ return either 0 or 1 but that might not be reveal the
> real status of the server process.
> Are you trying to reuse the initscript from your code? It would probably be a better
> idea to use apachectl(8) for such use cases (see the manual page for return codes
> of this program).
> HTH Ralf Mattes
> > thanks very much.
> > Maria