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

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

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

Reply to: