__runit_service: move logs out of etc

Some systems use etckeeper and having the logs there was not a great
idea to begin with :-).
This commit is contained in:
evilham 2023-04-21 11:11:03 +02:00
parent 7cd606a52f
commit 2511218dd6
Signed by untrusted user: evilham
GPG key ID: AE3EE30D970886BF

View file

@ -33,18 +33,25 @@ if [ "${state}" != "present" ]; then
exit
fi
# Setup run file
__file --state "${state}" --mode 0550 --source "${source}" \
--onchange "sv restart '${sv}' || true" \
"${run_file}"
export require="${require} __file${run_file}"
if [ -f "${__object}/parameter/log" ]; then
# Setup logger if requested
__directory --parents "${svdir}/${sv}/log/main"
export require="${require} __directory${svdir}/${sv}/log/main"
logdir="/var/log/runit"
__directory --parents "${svdir}/${sv}/log"
__directory --state absent "${svdir}/${sv}/log/main" # Remove lingering old fashioned log
__directory --parents "${logdir}/${sv}"
export require="${require} __directory${svdir}/${sv}/log __directory${logdir}/${sv}"
__file "${svdir}/${sv}/log/run" \
--state "${state}" \
--mode 0755 \
--onchange "sv restart '${sv}/log' || true" \
--source "-" <<EOF
#!/bin/sh
exec svlogd -tt ./main
exec svlogd -tt '${logdir}/${sv}'
EOF
fi
# Setup run file
__file --state "${state}" --mode 0755 --source "${source}" "${run_file}"