Mailing List Archive

Re: Crash in ~DVBChannel() - Wiki comments
Hi Roger,

I looked at the Wiki. Suggest removing the: Environment=HOME=/~/.mythtv line
because tilde expansion doesn't seem to work in the .service files. Plus,
you've set User=mythtv and that will set HOME to (in my opinion) the proper
value of /home/mythtv. I suspect you didn't want the leading slash either.

I just now read about BindsTo=, that's interesting, I need to try it out. My only
concern is that it sounds like a mysql failure mid-recording would stop the recording.

I prefer to use mythbackend --quiet... on the ExecStart line.

That way systemd isn't getting any output that needs to be redirected with
the StandardOutput and StandardError lines, so I don't have them either. And
like you, I prefer --logpath. Users of --syslog would want --quiet too so
as not to get double logging in the journal. I'm thinking that for the
average user, --syslog might be a better choice so they don't have to worry
about configuring logrotate etc.

The filename, /etc/systemd/system/mythbackend.service has potential problem.
If a user *somehow* gets Mythbuntu's .service, it will be in
/lib/systemd/system/mythtv-backend.service and since the names are different,
both would be started. I'd suggest naming it: /etc/systemd/system/mythtv-backend.service.

I really like the concise version you've added. Always thought the
other one was getting too long (and I've seen users copy it verbatim
rather than adjusting it.)

Just my 2 cents. I'd be happy to make changes, but don't want to stomp on
your work without getting your opinion.

Full disclosure, I'm still learning about systemd.

On 05/18/2017 06:25 AM, roger wrote:
...
> I have updated the systemd page in the mythtv wiki with an example that stops the database being shut down before the backend is. It also logs
> stderr to the systemd journal and runs mythbackend with the core resource limit set to infinity (N.B. this setting is further constrained by the
> rlimit of whatever user id the backend is set to up to use, in this case "mythtv").


--
Bill
_______________________________________________
mythtv-dev mailing list
mythtv-dev@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-dev
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Crash in ~DVBChannel() - Wiki comments [ In reply to ]
On 18 May 2017 5:57:43 pm Bill Meek <keemllib@gmail.com> wrote:

> Hi Roger,
>
> I looked at the Wiki. Suggest removing the: Environment=HOME=/~/.mythtv line
> because tilde expansion doesn't seem to work in the .service files. Plus,
> you've set User=mythtv and that will set HOME to (in my opinion) the proper
> value of /home/mythtv. I suspect you didn't want the leading slash either.
>
> I just now read about BindsTo=, that's interesting, I need to try it out.
> My only
> concern is that it sounds like a mysql failure mid-recording would stop the
> recording.
>
> I prefer to use mythbackend --quiet... on the ExecStart line.
>
> That way systemd isn't getting any output that needs to be redirected with
> the StandardOutput and StandardError lines, so I don't have them either. And
> like you, I prefer --logpath. Users of --syslog would want --quiet too so
> as not to get double logging in the journal. I'm thinking that for the
> average user, --syslog might be a better choice so they don't have to worry
> about configuring logrotate etc.
>
> The filename, /etc/systemd/system/mythbackend.service has potential problem.
> If a user *somehow* gets Mythbuntu's .service, it will be in
> /lib/systemd/system/mythtv-backend.service and since the names are different,
> both would be started. I'd suggest naming it:
> /etc/systemd/system/mythtv-backend.service.
>
> I really like the concise version you've added. Always thought the
> other one was getting too long (and I've seen users copy it verbatim
> rather than adjusting it.)
>
> Just my 2 cents. I'd be happy to make changes, but don't want to stomp on
> your work without getting your opinion.
>
> Full disclosure, I'm still learning about systemd.
>
> On 05/18/2017 06:25 AM, roger wrote:
> ...
>> I have updated the systemd page in the mythtv wiki with an example that
>> stops the database being shut down before the backend is. It also logs
>> stderr to the systemd journal and runs mythbackend with the core resource
>> limit set to infinity (N.B. this setting is further constrained by the
>> rlimit of whatever user id the backend is set to up to use, in this case
>> "mythtv").
>
>
> --
> Bill

Hi Bill,

I never looked closely at that HOME= line. I started from the sample conf
file and deleted the irrelevant bits. I just took the second of the two
HOME= lines and copied it across. You are quite correct, there only
substitution that goes on here is systemd specifiers, the shell is not
involved, and as you point out the leading / would stop it working even in
the shell! I will remove it.

I chose to use BindTo because loss of the database causes serious problems
to mythbackend. It will cause mythbackend to be terminated if the database
goes away.

The logging stuff is just my preference. I was thinking of moving the
ExecStart line into its own drop in conf file in a mythbackend.service.d
directory, to make it easier to edit parameters without having to touch the
main unit file.

Mythbackend uses logging to stderr in circumstances when the logging
mechanism may not be available. This is mostly at startup and shutdown. I
like to use systemd's journal facility to capture this.

I will add a note about the mythbuntu unit file.

Feel free to edit whatever you see fit. That it what wikis are for ????.

Roger


_______________________________________________
mythtv-dev mailing list
mythtv-dev@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-dev
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Crash in ~DVBChannel() - Wiki comments [ In reply to ]
On Fri, 19 May 2017 07:47:07 +0100, you wrote:

>On 18 May 2017 5:57:43 pm Bill Meek <keemllib@gmail.com> wrote:
>
>> Hi Roger,
>>
>> I looked at the Wiki. Suggest removing the: Environment=HOME=/~/.mythtv line
>> because tilde expansion doesn't seem to work in the .service files. Plus,
>> you've set User=mythtv and that will set HOME to (in my opinion) the proper
>> value of /home/mythtv. I suspect you didn't want the leading slash either.
>>
>> I just now read about BindsTo=, that's interesting, I need to try it out.
>> My only
>> concern is that it sounds like a mysql failure mid-recording would stop the
>> recording.
>>
>> I prefer to use mythbackend --quiet... on the ExecStart line.
>>
>> That way systemd isn't getting any output that needs to be redirected with
>> the StandardOutput and StandardError lines, so I don't have them either. And
>> like you, I prefer --logpath. Users of --syslog would want --quiet too so
>> as not to get double logging in the journal. I'm thinking that for the
>> average user, --syslog might be a better choice so they don't have to worry
>> about configuring logrotate etc.
>>
>> The filename, /etc/systemd/system/mythbackend.service has potential problem.
>> If a user *somehow* gets Mythbuntu's .service, it will be in
>> /lib/systemd/system/mythtv-backend.service and since the names are different,
>> both would be started. I'd suggest naming it:
>> /etc/systemd/system/mythtv-backend.service.
>>
>> I really like the concise version you've added. Always thought the
>> other one was getting too long (and I've seen users copy it verbatim
>> rather than adjusting it.)
>>
>> Just my 2 cents. I'd be happy to make changes, but don't want to stomp on
>> your work without getting your opinion.
>>
>> Full disclosure, I'm still learning about systemd.
>>
>> On 05/18/2017 06:25 AM, roger wrote:
>> ...
>>> I have updated the systemd page in the mythtv wiki with an example that
>>> stops the database being shut down before the backend is. It also logs
>>> stderr to the systemd journal and runs mythbackend with the core resource
>>> limit set to infinity (N.B. this setting is further constrained by the
>>> rlimit of whatever user id the backend is set to up to use, in this case
>>> "mythtv").
>>
>>
>> --
>> Bill
>
>Hi Bill,
>
>I never looked closely at that HOME= line. I started from the sample conf
>file and deleted the irrelevant bits. I just took the second of the two
>HOME= lines and copied it across. You are quite correct, there only
>substitution that goes on here is systemd specifiers, the shell is not
>involved, and as you point out the leading / would stop it working even in
>the shell! I will remove it.
>
>I chose to use BindTo because loss of the database causes serious problems
>to mythbackend. It will cause mythbackend to be terminated if the database
>goes away.
>
>The logging stuff is just my preference. I was thinking of moving the
>ExecStart line into its own drop in conf file in a mythbackend.service.d
>directory, to make it easier to edit parameters without having to touch the
>main unit file.
>
>Mythbackend uses logging to stderr in circumstances when the logging
>mechanism may not be available. This is mostly at startup and shutdown. I
>like to use systemd's journal facility to capture this.
>
>I will add a note about the mythbuntu unit file.
>
>Feel free to edit whatever you see fit. That it what wikis are for ?.
>
>Roger

This is what the Mythbuntu 16.04
/lib/systemd/system/mythtv-backend.service file has in it:

[Unit]
Description=MythTV Backend
Documentation=https://www.mythtv.org/wiki/Mythbackend
After=mysql.service network.target

[Service]
User=mythtv
EnvironmentFile=-/etc/mythtv/additional.args
ExecStart=/usr/bin/mythbackend --quiet --syslog local7
$ADDITIONAL_ARGS
StartLimitBurst=10
StartLimitInterval=10m
Restart=on-failure
RestartSec=1

[Install]
WantedBy=multi-user.target

It uses the /etc/mythtv/additional.args file for command line
parameters. This is what I have in mine:

#ADDITIONAL_ARGS=-v all --loglevel debug
ADDITIONAL_ARGS=-v record,dvbcam

I am not a fan of how their default StartLimit settings work - I have
had them stop me from starting mythbackend when I needed to, and
having to hunt around to find this command to allow me to start it:

systemctl reset-failed mythtv-backend

The default file also fails to make mythbackend wait until the network
is up enough for actual access to network tuners to work, so you have
to override it for that.

Logging via syslog is handled by the /etc/rsyslog.d/40-mythtv.conf
file:

# Begin /etc/rsyslog.d/40-mythtv.conf

# Make MythTV logs readable by world
$FileCreateMode 0644

# Send all logging from MythTV applications to application-specific
log files.
if $msg startswith ' mythbackend' then /var/log/mythtv/mythbackend.log
& ~
if $msg startswith ' mythfrontend' then
/var/log/mythtv/mythfrontend.log
& ~
if $msg startswith ' mythjobqueue' then
/var/log/mythtv/mythjobqueue.log
& ~
if $msg startswith ' mythmediaserver' then
/var/log/mythtv/mythmediaserver.log
& ~
if $msg startswith ' mythtv-setup' then
/var/log/mythtv/mythtv-setup.log
& ~
if $msg startswith ' mythfilldatabase' then
/var/log/mythtv/mythfilldatabase.log
& ~
if $msg startswith ' mythcommflag' then
/var/log/mythtv/mythcommflag.log
& ~
if $msg startswith ' mythpreviewgen' then
/var/log/mythtv/mythpreviewgen.log
& ~
if $msg startswith ' mythtranscode' then
/var/log/mythtv/mythtranscode.log
& ~
if $msg startswith ' mythmetadatalookup' then
/var/log/mythtv/mythmetadatalookup.log
& ~
if $msg startswith ' mythutil' then /var/log/mythtv/mythutil.log
& ~
if $msg startswith ' mythwelcome' then /var/log/mythtv/mythwelcome.log
& ~
if $msg startswith ' mythshutdown' then
/var/log/mythtv/mythshutdown.log
& ~
if $msg startswith ' mythlcdserver' then
/var/log/mythtv/mythlcdserver.log
& ~
if $msg startswith ' mythccextractor' then
/var/log/mythtv/mythccextractor.log
& ~
if $msg startswith ' mythavtest' then /var/log/mythtv/mythavtest.log
& ~

# Set FileCreateMode back to default. This should be the same value
as specified
# in the /etc/rsyslog.conf file.
$FileCreateMode 0640

# End /etc/rsyslog.d/40-mythtv.conf


Logging that way works well, in my opinion.
_______________________________________________
mythtv-dev mailing list
mythtv-dev@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-dev
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org