__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: evilham
GPG key ID: AE3EE30D970886BF

View file

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