[solved] tvheadend as systemd-service: not starting
Added by joky joky over 7 years ago
solved
The issue caused by the user-setting of systemd. I don't know why it works in shell as user hts but not in systemd as user hts but as long as it works (and tvheadend doesn't run as root) I'm fine:
working tvheadend.service (ubuntu LTS):
[Unit] Description=tvheadend Wants=network.target [Service] PIDFile=/run/tvheadend.pid Type=simple ExecStart=/usr/bin/tvheadend -s -c /data/hts/config -u hts -g hts -p /run/tvheadend.pid Restart=always RestartSec=3 [Install] WantedBy=multi-user.target
Hi,
I'm running tvheadend connected to a local CA-card via oscam, sat-ip receivers as source and RPI2/3 as clients.
Recently I updated to the most recent tvheadend version, updated the systemd-scripts and added a monit-config, to supervise tvheadend.
Now I can run tvheadend in console (as root or user hts) but not using systemd, because the latter seems to exit/crash.
I disabled caclient because starting with systemd even caused issues there - without any success.
[....] Apr 14 07:50:24 hts tvheadend[13034]: mpegts: 11876H in Astra 19.2E (0x557118510730) - deleting Apr 14 07:50:24 hts tvheadend[13034]: epgdb: save start Apr 14 07:50:25 hts tvheadend[13034]: epgdb: stored (size 2877421) Apr 14 07:50:25 hts tvheadend[13034]: STOP: Exiting HTS Tvheadend
root@hts:~# systemctl status tvheadend.service ● tvheadend.service - tvheadend Loaded: loaded (/etc/systemd/system/tvheadend.service; enabled; vendor preset: enabled) Active: inactive (dead) since Fre 2017-04-14 07:50:25 CEST; 5min ago Process: 13031 ExecStart=/bin/sh -c /usr/bin/tvheadend -f -s -c /data/hts/config -u hts -g hts -p /run/tvheadend.pid -a -1 --satip_xml http://10.19.11.10:8080/desc.xml --satip Main PID: 13031 (code=exited, status=0/SUCCESS)
The config files:
[Unit] Description=tvheadend Wants=network.target [Service] User=hts PIDFile=/run/tvheadend.pid Type=simple # BusName=org.tvheadend.server ExecStart=/usr/bin/tvheadend -f -s -c /data/hts/config -u hts -g hts -p /run/tvheadend.pid -a -1 --satip_xml http://10.19.11.10:8080/desc.xml --satip_xml http://10.19.12.10:8080/desc.xml --satip_xml http://10.19.13.50:80/rootDescr # Restart=always # RestartSec=9 [Install] WantedBy=multi-user.target
Is there anything I missed? Might it be a bug in the latest tvheadend version?
kind regards
Replies (5)
RE: tvheadend as systemd-service: not starting - Added by Robert Cameron over 7 years ago
In your unit file, you are forking/daemonizing the tvheadend process, but you do not have the "Type" set to "forking". Try changing it from "simple" to "forking".
I could be wrong, but that's how my unit file is set up, and I don't have any problems with it ...
RE: tvheadend as systemd-service: not starting - Added by joky joky over 7 years ago
hi!
thank you for your response, but it was forking before :-(
regards
RE: tvheadend as systemd-service: not starting - Added by Joe User over 7 years ago
Upgraded from what version?
It seems to be exiting, not crashing. Need more of tvheadend log to see why it is exiting...
Does it automatically get restarted?
RE: tvheadend as systemd-service: not starting - Added by Joe User over 7 years ago
joky joky wrote:
[Service]
User=hts
BTW - if you already initially run the tvheadend as user hts, you should not specify -u hts -g hts.
RE: [solved] tvheadend as systemd-service: not starting - Added by joky joky over 7 years ago
Hi Joe User,
removing "User=hts" resolved that issue! See updated post above