[mythtv-users] auto-restarting mythbackend
Hika van den Hoven
hikavdh at gmail.com
Fri Oct 16 00:24:13 UTC 2015
Hoi Jerome,
Friday, October 16, 2015, 2:15:35 AM, you wrote:
> What are people doing about restarting mythbackend when it fails?
> There are a number of scripts on
> https://www.mythtv.org/wiki/Status_Monitoring_How_To but what's the
> crowd favourite? That could relieve a few problems and would be
> handy in any event. Has anyone done anything with systemd for this?
> Looks like systemd has mechanisms for it. My
> /usr/lib/systemd/system/mythbackend.service has
> # Whether systemd will continue over-watch and restart on any halt
> #Restart=always
> Does this work?
I have the following script running every minute in cron with this
line:
/root/test-service.sh mythbackend mythbackend mythtv-setup
It checks every minute if the service with the first name is still
running and if also the program with the third name is not running it
restarts the second name. This way it won't restart if I have
mythtv-setup running. You only have te change the restart line to the
one for your distribution as this is Gentoo style. And it also logs
any restart.
#!/bin/sh
# Primair te testen Service
if [ "$1" != "" ]; then
ps -C $1 > /dev/null && exit 0;
else
echo Geef een Service to test
exit 1;
fi
# Een eventuele Secundaire service
if [ "$3" != "" ]; then
ps -C $3 > /dev/null && exit 0;
fi
echo "`date +%Y-%m-%d\ %T.%-3N` $1 not running" >> /var/log/Service-restart.log;
rc-config restart $2
exit 0;
Tot mails,
Hika mailto:hikavdh at gmail.com
"Zonder hoop kun je niet leven
Zonder leven is er geen hoop
Het eeuwige dilemma
Zeker als je hoop moet vernietigen om te kunnen overleven!"
De lerende Mens
More information about the mythtv-users
mailing list