[mythtv] Dazed and Confused (Was Re: [mythtv-commits] Ticket #10236: Systemd Mythbackend startup does not check for existing process

R. G. Newbury newbury at mandamus.org
Fri Jan 6 22:48:35 UTC 2012


On 01/05/2012 08:28 PM, Richard Shaw wrote:
> Can you provide a copy of the full mythbackend.service file? I didn't
> use that comment for the RPM Fusion service file and it may not be
> necessary.
>
> After several iterations we ended up with Type=simple. That way you
> don't have to worry about a PID file. Systemd will take care of it and
> kill it when you run systemctl stop mythbackend.service.
>
> Other than one reported instance of mythbackend trying to connect to
> mysql before it was ready to accept connections, which is either a
> systemd or mysql bug, it's worked quite well.
>
> Richard
>
> Here's the full unit file:
> [Unit]
> Description=MythTV backend service
> After=network.target mysqld.service
>
> [Service]
> Type=simple
> Environment=MYTHCONFDIR=/etc/mythtv
> Environment=HOME=/usr/share/mythtv
> User=mythtv
> ExecStart=/usr/bin/mythbackend --logfile /var/log/mythtv/mythbackend.log
>
> [Install]
> WantedBy=multi-user.target


*****************************************
Here is the Fedora 15 version. It uses Type=forking which (I think) 
means that systemd automagically restarts it if it crashes (I read 
something about that, but cannot find the reference now...of course!)

See other messages for other history.

*****************************************
#/usr/local/bin/pre-start.sh

#!/bin/bash

# An 'is-running' check used to be performed by the old sysinit script
# Instead we will kill any running process.
if [ -e /var/run/mythtv/backend.pid ]; then
     killall mythbackend;
fi
echo " Killed prior errant process"

# Original unamended version from here on

if [ ! -e /var/run/mythtv ]; then
    mkdir /var/run/mythtv
#   touch /var/run/mythtv/backend.pid;
fi

echo "Created pid folder"
******************************************

******************************************
#! mythbackend.service for systemd
# installed to /lib/systemd/system
# amended only to change the user

[Unit]
Description=mythbackend daemon
After=mysqld.service

[Service]
EnvironmentFile=/etc/sysconfig/mythbackend
ExecStartPre=/usr/local/bin/pre-start.sh
ExecStart=/usr/local/bin/mythbackend --daemon --user geoffrey --logfile 
/var/log/mythtv/backend.log --pidfile /var/run/mythtv/backend.pid
PIDFile=/var/run/mythtv/backend.pid
Type=forking

[Install]
WantedBy=multi-user.target

*************************************

Note that this would need an 'After=httpd.service' line if webmin is to 
be installed and used. I think multi-user.targer implies network.target 
already..

These are quite similar. Fedora

Geoff




-- 



More information about the mythtv-dev mailing list