85eacfc96a04547ef25aabbc06440039715084c2jorton/* Licensed to the Apache Software Foundation (ASF) under one or more
85eacfc96a04547ef25aabbc06440039715084c2jorton * contributor license agreements. See the NOTICE file distributed with
85eacfc96a04547ef25aabbc06440039715084c2jorton * this work for additional information regarding copyright ownership.
85eacfc96a04547ef25aabbc06440039715084c2jorton * The ASF licenses this file to You under the Apache License, Version 2.0
85eacfc96a04547ef25aabbc06440039715084c2jorton * (the "License"); you may not use this file except in compliance with
85eacfc96a04547ef25aabbc06440039715084c2jorton * the License. You may obtain a copy of the License at
85eacfc96a04547ef25aabbc06440039715084c2jorton * Unless required by applicable law or agreed to in writing, software
85eacfc96a04547ef25aabbc06440039715084c2jorton * distributed under the License is distributed on an "AS IS" BASIS,
85eacfc96a04547ef25aabbc06440039715084c2jorton * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
85eacfc96a04547ef25aabbc06440039715084c2jorton * See the License for the specific language governing permissions and
85eacfc96a04547ef25aabbc06440039715084c2jorton * limitations under the License.
85eacfc96a04547ef25aabbc06440039715084c2jortonstatic int systemd_pre_mpm(apr_pool_t *p, ap_scoreboard_e sb_type)
85eacfc96a04547ef25aabbc06440039715084c2jorton "STATUS=Processing requests...\n"
85eacfc96a04547ef25aabbc06440039715084c2jorton if (rv < 0) {
85eacfc96a04547ef25aabbc06440039715084c2jorton ap_log_perror(APLOG_MARK, APLOG_ERR, 0, p, APLOGNO(02395)
85eacfc96a04547ef25aabbc06440039715084c2jortonstatic int systemd_monitor(apr_pool_t *p, server_rec *s)
85eacfc96a04547ef25aabbc06440039715084c2jorton /* up_time in seconds */
85eacfc96a04547ef25aabbc06440039715084c2jorton up_time = (apr_uint32_t) apr_time_sec(apr_time_now() -
85eacfc96a04547ef25aabbc06440039715084c2jorton apr_strfsize((unsigned long)((float) (sload.bytes_served)
85eacfc96a04547ef25aabbc06440039715084c2jorton "STATUS=Total requests: %lu; Idle/Busy workers %d/%d;"
85eacfc96a04547ef25aabbc06440039715084c2jorton ((float) sload.access_count) / (float) up_time, bps);
85eacfc96a04547ef25aabbc06440039715084c2jorton if (rv < 0) {
85eacfc96a04547ef25aabbc06440039715084c2jorton ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, APLOGNO(02396)
da5dc6a3cb274b5e747f50713086a212c5afc738jkaluza /* Shutdown httpd when nothing is sent for shutdown_timer seconds. */
58e5bc883b8fcd6093c8569d10ea551ed9894e8ejkaluza /* mpm_common.c: INTERVAL_OF_WRITABLE_PROBES is 10 */
da5dc6a3cb274b5e747f50713086a212c5afc738jkaluza if (shutdown_timer > 0 && shutdown_counter >= shutdown_timer) {
da5dc6a3cb274b5e747f50713086a212c5afc738jkaluza "STATUS=Stopped as result of IdleShutdown "
da5dc6a3cb274b5e747f50713086a212c5afc738jkaluza "timeout.");
da5dc6a3cb274b5e747f50713086a212c5afc738jkaluza ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, APLOGNO(02804)
85eacfc96a04547ef25aabbc06440039715084c2jorton /* We know the PID in this hook ... */
85eacfc96a04547ef25aabbc06440039715084c2jorton ap_hook_pre_mpm(systemd_pre_mpm, NULL, NULL, APR_HOOK_LAST);
85eacfc96a04547ef25aabbc06440039715084c2jorton /* Used to update httpd's status line using sd_notifyf */
85eacfc96a04547ef25aabbc06440039715084c2jorton ap_hook_monitor(systemd_monitor, NULL, NULL, APR_HOOK_MIDDLE);
da5dc6a3cb274b5e747f50713086a212c5afc738jkaluzastatic const char *set_shutdown_timer(cmd_parms *cmd, void *dummy,
da5dc6a3cb274b5e747f50713086a212c5afc738jkaluza const char *arg)
da5dc6a3cb274b5e747f50713086a212c5afc738jkaluza const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
da5dc6a3cb274b5e747f50713086a212c5afc738jkaluzaAP_INIT_TAKE1("IdleShutdown", set_shutdown_timer, NULL, RSRC_CONF,
da5dc6a3cb274b5e747f50713086a212c5afc738jkaluza "Number of seconds in idle-state after which httpd is shutdown"),