<div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Mar 14, 2024, 8:34 a.m. Stephen Worthington <<a href="mailto:stephen_agent@jsw.gen.nz">stephen_agent@jsw.gen.nz</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Thu, 14 Mar 2024 08:01:01 -0400, you wrote:<br>
<br><snip><br>
Unless you specify otherwise, systemd will run everything as root.<br>
However, the standard mythtv-backend.service file includes this line:<br>
<br>
User=mythtv<br>
<br>
so mythbackendpre.sh will be run from user mythtv.  Which means that<br>
you will have to do something like the touch/chown/setfacl commands to<br>
create the log file for it, and they need to be done as root, so could<br>
not be done from the mythtv-backend.service file except by using an<br>
sudo helper script.  Which is complicated.<br>
<br>
The other alternative, which I think would be easier, would be to run<br>
mythfrontendpre.sh as a separate systemd unit, and then make<br>
mythtv-backend wait for the mythfrontendpre.service to complete before<br>
it is run.  Then the mythfrontendpre.sh service can just be run as<br>
root.  So you would put something like this in your<br>
mythtv-backend.service override files:<br>
<br>
[Unit]<br>
Wants=mythbackendpre.service<br>
After=mythbackendpre.service<br>
<br>
That is what I do with my local-network-pingable.service.<br>
<br>
Another alternative is to use the systemd journal to log to.  To do<br>
that, you make the output from mythfrontendpre.sh go to stdout instead<br>
of putting it in a log file.  You can then see the output by doing<br>
"journalctl -u mythtv-backend".  I think stderr output also goes to<br>
the journal.<br><br></blockquote></div></div><div dir="auto">Thanks again for a great explanation. Realizing it's not something I need to check on frequently, I went with the last option you suggested and used the journal method. <br></div><div dir="auto"><br></div><div dir="auto">Thanks again. </div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
</blockquote></div></div></div>