mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-07-12 18:59:50 +03:00
This makes a reload to happen even if the config hasn't changed. Useful for reloading TLS certificates from disk.
39 lines
889 B
Bash
39 lines
889 B
Bash
#!/sbin/openrc-run
|
|
supervisor=supervise-daemon
|
|
|
|
name="Caddy web server"
|
|
description="Fast, multi-platform web server with automatic HTTPS"
|
|
description_checkconfig="Check configuration"
|
|
description_reload="Reload configuration without downtime"
|
|
|
|
: ${caddy_opts:="--config /etc/caddy/Caddyfile --adapter caddyfile"}
|
|
|
|
command=/usr/sbin/caddy
|
|
command_args="run $caddy_opts"
|
|
command_user=caddy:caddy
|
|
extra_commands="checkconfig"
|
|
extra_started_commands="reload"
|
|
capabilities="^cap_net_bind_service"
|
|
|
|
depend() {
|
|
need net localmount
|
|
after firewall
|
|
}
|
|
|
|
checkconfig() {
|
|
ebegin "Checking configuration for $name"
|
|
su ${command_user%:*} -s /bin/sh -c "$command validate $caddy_opts"
|
|
eend $?
|
|
}
|
|
|
|
reload() {
|
|
ebegin "Reloading $name"
|
|
su ${command_user%:*} -s /bin/sh -c "$command reload --force $caddy_opts"
|
|
eend $?
|
|
}
|
|
|
|
stop_pre() {
|
|
if [ "$RC_CMD" = restart ]; then
|
|
checkconfig || return $?
|
|
fi
|
|
}
|