mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-07-15 12:15:22 +03:00
I use thttpd for exposing Prometheus metrics using CGI script. Now it logs "spawned CGI process ..." to syslog each time the metrics endpoint is requested which fills /var/log/messages.
51 lines
948 B
Bash
51 lines
948 B
Bash
#!/sbin/openrc-run
|
|
|
|
name=thttpd
|
|
description="tiny/turbo/throttling HTTP server"
|
|
|
|
extra_started_commands="reopen stats"
|
|
description_reopen="Reopen log file"
|
|
description_stats="Dump statistics to syslog"
|
|
|
|
: ${cfgfile:=/etc/$RC_SVCNAME.conf}
|
|
|
|
command=/usr/sbin/thttpd
|
|
command_args="-D -C $cfgfile $command_args"
|
|
command_background=yes
|
|
pidfile="/run/$RC_SVCNAME.pid"
|
|
|
|
required_files="$cfgfile"
|
|
|
|
depend() {
|
|
need net
|
|
after firewall
|
|
}
|
|
|
|
start_pre() {
|
|
# This works only in Alpine's thttpd.
|
|
if ! yesno "${log_debug:-yes}"; then
|
|
export THTTPD_LOG_DEBUG=0
|
|
fi
|
|
}
|
|
|
|
reopen() {
|
|
ebegin "Reopening $name log file"
|
|
|
|
if [ "$supervisor" ]; then
|
|
$supervisor "$RC_SVCNAME" --signal HUP
|
|
else
|
|
start-stop-daemon --signal HUP --pidfile "$pidfile"
|
|
fi
|
|
eend $?
|
|
}
|
|
|
|
stats() {
|
|
ebegin "Dump $name statistics to syslog"
|
|
|
|
if [ "$supervisor" ]; then
|
|
$supervisor "$RC_SVCNAME" --signal USR2
|
|
else
|
|
start-stop-daemon --signal USR2 --pidfile "$pidfile"
|
|
fi
|
|
eend $?
|
|
}
|