#!/sbin/openrc-run description="Caddy web server" pidfile=${pidfile:-"/run/${RC_SVCNAME}.pid"} command="/usr/bin/caddy" command_user="${command_user:-"http:http"}" command_args="${command_args:-"run --config /etc/caddy/caddy_config.json"}" command_background="true" logfile=/var/log/${RC_SVCNAME}/${RC_SVCNAME}.log start_stop_daemon_args="--user ${command_user%:*} --group ${command_user#*:} --stdout ${logfile} --stderr ${logfile}" : "${supervisor:=supervise-daemon}" : "${respawn_delay:=5}" : "${respawn_max:=10}" : "${respawn_period:=60}" depend() { need net } start() { checkpath --directory --mode 755 --owner root "${pidfile%/*}" checkpath --directory --mode 755 --owner "${command_user}" "${logfile%/*}" default_start }