Re: Bootlogd in runit
Reply #1 –
So it turns out there is a script /usr/lib/rc/sv.d/bootlogd which I somehow didn't notice before. The earliest I can link it in /etc/rc/sysinit without triggering any errors is right after 05-root.
My only question now is where does it go in /etc/rc/shutdown?
I tried putting it last, but it doesn't catch anything past 40-misc, since it probably gets killed by kill_all (which matches all processes with session id not 0 or 1, and on my system bootlogd has session id around 510). Is there any way to stop bootlogd getting killed to also capture later events?
Maybe something like this in 40-misc?
kill_all(){
SESSION_IDS=0,1
test -f /run/bootlogd.pid && SESSION_ID+=,$(< /run/bootlogd.pid)
pkill --inverse -s$SESSION_IDS -TERM
sleep 1
pkill --inverse -s$SESSION_IDS -KILL
}