[mythtv-users] auto-restarting mythbackend

Jerome Yuzyk jerome at supernet.ab.ca
Fri Oct 16 17:33:28 UTC 2015


On Friday, October 16, 2015 09:20:28 AM Frank Phillips wrote:
> On Thu, Oct 15, 2015 at 8:34 PM, Jerome Yuzyk <jerome at supernet.ab.ca> wrote:
> 
> > On Thursday, October 15, 2015 08:40:31 PM Rich Freeman wrote:
> > > On Thu, Oct 15, 2015 at 8:15 PM, Jerome Yuzyk <jerome at supernet.ab.ca>
> > wrote:
> > > > # Whether systemd will continue over-watch and restart on any halt
> > > > #Restart=always
> > > >
> > > > Does this work?
> > >
> > > Yes.
> > >
> > > cat /etc/systemd/system/mythbackend.service.d/00rich.conf
> > >
> > > [Unit]
> > > After=mariadb-contain.service mariadb-wait-online at mariadb.service
> > > nss-lookup.target
> > > Wants=mariadb-wait-online at mariadb.service
> > >
> > > [Service]
> > > Nice=-5
> > > IOSchedulingClass=1
> > > Restart=always
> > >
> > > (it is better to override units in /etc/systemd/system instead of
> > > modifying the ones in /usr/lib, which will not be cfg-protected
> > > anyway)
> > >
> > > You won't need most of that.  You can just drop everything but
> > > [Service] and Restart=always.  The scheduling stuff might be useful to
> > > anybody, and the rest is just dependencies on my own units since my
> > > database is inside a container.
> > >
> > > Everything but the [Unit] stuff should be distro-agnostic as well.
> >
> > Excellent, thanks! I've been reading a bit more of
> > http://www.freedesktop.org/software/systemd/man/systemd.service.html
> > and there are several Restart= options, one of which is "on-failure". That
> > might be better targeted to abnormal endings? I start/stop mythbackend to
> > do mythtv-setup (running that a lot lately)  so I probably don't want to
> > always auto-restart it.
> >
> > Hika: That's a very tidy way of doing it!
> >
> 
> Another pro tip: once you copy a unit file to /etc/systemd/system for
> editing, you can use systemd-delta to see the changes you've made.

Neato, a shortcut for diff-ing. Another sometimes-handy tool is

    systemd-analyze blame

to profile system startup, in case you're wondering why it takes so long.

-- 
A little of Jerome's MythTV World: http://mythtv.bss.ab.ca


More information about the mythtv-users mailing list