__runit_service: move logs out of etc #27

Merged
evilham merged 1 commit from runit-service-bugfix into master 2023-04-21 12:56:12 +00:00

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}"