API call to terminate server?

API call to terminate server?

am 05.02.2010 19:40:20 von Ade Lee

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 for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org