aports/community/acmed/acmed.initd
2023-05-09 17:24:51 +02:00

40 lines
790 B
Bash

#!/sbin/openrc-run
description="ACME (RFC 8555) client daemon"
: ${cfgfile:=/etc/acmed/acmed.toml}
: ${logfile=/var/log/acmed.log}
: ${syslog:=yes}
command="/usr/bin/acmed"
command_args="
--foreground
--no-pid-file
--config $cfgfile
--log-level ${loglevel:-warn}
$command_args
"
command_background=true
pidfile="/run/$RC_SVCNAME.pid"
: ${command_user:=acmed:acmed}
: ${directory:=/var/lib/acmed}
required_files="$cfgfile"
depend() {
need net
after firewall
}
start_pre() {
checkpath -d -m 755 -o "$command_user" "$directory" || return 1
if yesno "$syslog"; then
command_args="$command_args --log-syslog"
elif [ "$logfile" ]; then
command_args="$command_args --log-stderr"
error_log="$logfile"
checkpath -f -q -m 644 -o "$command_user" "$logfile" || return 1
fi
}