Attempting to access stderr in /etc/local fails on systemd
but works on other init systems.
Someone on Fedi tells me that is because systemd expects
services to treat fd#2 as a socket.
However, /etc/rc.local is a POSIX shell script, and POSIX
is pretty clear on std{in,out,err}.
Perhaps /lib/systemd/system/rc-local.service and/or
/lib/systemd/system/rc-local.service.d/debian.conf
need to be changed to invoke /etc/rc.local with 2>&1
to fix that? (Assuming it *can* write to stdout.)
https://mastodon.social/@shaknais/116711663013528767 This needs to be fixed, somehow.
Dixi quod…
Perhaps like this?
ExecStart=/bin/sh -c '{ /etc/rc.local start 2>&1 >&3 | cat >&2; } 3>&1 | cat'
That is, if that even works (not tested, only the redirections).
Hi,
Which clause do you refer to?
Using sockets to back std{in,out,err} seems pretty common, for example
the "inetd" superserver does so as do CGI scripts and many other
things. It would be strange if POSIX was to forbid all of these?
Ansgar
Hmh, POSIX says applications write messages to it, and that was what did not work. At that point, I didn’t realise that it was only writing to /dev/stderr that failed, not writing to fd#2 in general. Even though, that needs to be fixed IMHO. bye, //mirabilos