Fedora 21 start TVHeadEnd at boot
Added by John Brines over 9 years ago
Hi Guys,
Has anyone setup TVHeadEnd to boot at start up? I have tried the init.d method but it isn't working.
#!/bin/bash # # tvheadend This shell script takes care of starting and stopping # tvheadend. # # chkconfig: 2345 65 35 # description: tvheadend provides support for updating dynamic DNS services. #CONF=/etc/tvheadend/tvheadend.conf program=tvheadend [ -f $CONF ] || exit 0 system=unknown if [ -f /etc/fedora-release ]; then system=fedora elif [ -f /etc/redhat-release ]; then system=redhat elif [ -f /etc/debian_version ]; then system=debian fi PID='' if [ "$system" = "fedora" ] || [ "$system" = "redhat" ]; then . /etc/init.d/functions PID=`pidofproc $program` else PID=`ps -aef | grep "$program - sleep" | grep -v grep | awk '{print $2}'` fi PATH=/opt/tvheadend/build.linux:${PATH} export PATH # See how we were called. case "$1" in start) # Start daemon. DELAY=`grep -v '^\s*#' $CONF | grep -i -m 1 "daemon" | awk -F '=' '{print $2}'` if [ -z "$DELAY" ] ; then DELAY="-daemon 300" else DELAY='' fi echo -n "Starting tvheadend: " if [ "$system" = "fedora" ] || [ "$system" = "redhat" ]; then daemon $program $DELAY else tvheadend $DELAY fi echo ;; stop) # Stop daemon. echo -n "Shutting down tvheadend: " if [ -n "$PID" ] ; then if [ "$system" = "fedora" ] || [ "$system" = "redhat" ]; then killproc $program else kill $PID fi else echo "tvheadend is not running" fi echo ;; restart) $0 stop $0 start ;; status) if [ "$system" = "fedora" ] || [ "$system" = "redhat" ]; then status $program else if test "$PID" then for p in $PID do echo "$program (pid $p) is running" done else echo "$program is stopped" fi fi ;; *) echo "Usage: tvheadend {start|stop|restart|status}" exit 1 esac exit 0
Replies (2)
RE: Fedora 21 start TVHeadEnd at boot - Added by Brendon Oliver over 9 years ago
Hi John,
I'm running tvheadend on Fedora 21 and have no problems getting it to start at boot. Have you tried the above script from the command line to make sure it works as expected?
I'm guessing you have the above script in /etc/init.d and that it's executable? Did you run chkconfig? ie. (presuming your init script is named 'tvheadend'):
1) does "chkconfig --list tvheadend" report anything?
if not, then:
2) chkconfig --add tvheadend
chkconfig --level 2345 tvheadend on
and try #1 again...
I think that's all I had to do to get my initscript running, but it was ages ago that I set it up.
Good luck!
- Brendon
RE: Fedora 21 start TVHeadEnd at boot - Added by Brendon Oliver over 9 years ago
Well my system made a liar out of me!!!
I had to reboot the Fedora box last night for the first time in maybe a cpl of months and the tvheadend service seemed to start up but there was no process running. If I ran the initscript by hand (which had always worked in the past) it would say "ok" but again, there was no process running. Mystery!
In the end I got it to work via systemd instead of the SysV-style (above).
1) From the source tree:
copy rpm/tvheadend.sysconfig to /etc/sysconfig/tvheadend
copy rpm/tvheadend.service to /etc/systemd/system
Edit both files to suit your setup; I set permissions on them to owner/group root:root & mode 644)
2) systemctl enable tvheadend
3) systemctl start tvheadend (or just reboot)
seems to be working fine for me now. Hope this helps.