Java Mailing List Archive

http://www.apache-httpd.com/

Home » users.httpd »

[users@httpd] API call to terminate server?

Ade Lee

2010-02-05


Author LoginPost Reply
Hi,

How I might terminate an apache process from from one of the child
processes? (apache 2.x)

That is - is there a C API call (ap_* ?) that I can call to ask the
parent process to terminate (and thereby also terminate the other
children too)?

The context of this is that I have a requirement to terminate the server
if writes to an audit log fail (if the partition is full for instance).

I could make a system() call to "httpd -f httpd.conf -k stop", but it
would be nicer to do it with the appropriate API call(s).

As an aside, I did try to send a SIGTERM signal to the parent using:

if (kill(getppid(), SIGTERM)<0) {
  last_err = errno;
  m_audit_log->get_context()->LogError( "RA::AuditThis",
    __LINE__,
    "AuditThis: Failure to send signal. Error: %d : %s",
              last_err, strerror(last_err));
}

and got "Error: 1 : Operation not permitted".

Thanks,
Ade Lee



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@(protected)
 "  from the digest: users-digest-unsubscribe@(protected)
For additional commands, e-mail: users-help@(protected)

©2008 apache-httpd.com - Jax Systems, LLC, U.S.A.