Sundtek Support Forum

English => Sundtek MediaTV Pro (Europe) => Thema gestartet von: erdah am September 16, 2009, 05:40:38 Nachmittag

Titel: Autostart tvheadend
Beitrag von: erdah am September 16, 2009, 05:40:38 Nachmittag
I'm using Tvheadend as streaming server. How to make sure Tvheadend starts after the driver is loaded?
Titel: Re:Autostart tvheadend
Beitrag von: Sundtek am September 16, 2009, 05:47:33 Nachmittag
you can autostart tvheadend by adding a corresponding entry to /etc/rc.local or to add an initscript to /etc/init.d/

rc.local is probably the easier way to do this.
Titel: Re:Autostart tvheadend
Beitrag von: erdah am September 16, 2009, 09:52:06 Nachmittag
Tvheadend is already starting automatically by initscript. The problem is that it starts before the driver is loaded. Because of that I have to manually restart Tvheadend after each reboot.
Titel: Re:Autostart tvheadend
Beitrag von: Sundtek am September 17, 2009, 01:36:07 Vormittag
edit the tvheadend initscript

(this is just the example of the mediasrv script)
#! /bin/sh
### BEGIN INIT INFO
# Provides:          mediasrv
# Required-Start:    $local_fs $remote_fs
# Required-Stop:     $local_fs $remote_fs
# Should-Start:      $syslog
# Should-Stop:       $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      1
# Short-Description: mediasrv startup script
# Description:       this file initially starts the Sundtek Multimedia Framework
### END INIT INFO

add mediasrv to Required-Start: section of tvheadend

### BEGIN INIT INFO
# Provides:          tvheadend
# Required-Start:    $local_fs $remote_fs mediasrv
...

afterwards run:

update-rc.d tvheadend defaults

this should update the order when tvheadend will be started in /etc/rc[n].d/*

Scripts start with S[n]scriptname and are linked to /etc/init.d/scriptname, n indicates the index in which order the scripts sould be started. You might have to adjust this manually but this reply should give you a hint how to solve your request.

you might need to replace "tvheadend" with the name of your local tvheadend initscript.
Titel: Re:Autostart tvheadend
Beitrag von: erdah am September 20, 2009, 07:35:50 Nachmittag
Excellent, thanks!
Titel: Re:Autostart tvheadend
Beitrag von: rasmus1701 am April 07, 2012, 10:36:47 Nachmittag
Sorry to wake up an old thread but this problem (tvheadend starting before the usb tuner driver) can no longer be solved this way since the mediasrv init script is no longer deployed. How is mediasrv started now, and how to make sure it launches before tvheadend?
Titel: Re:Autostart tvheadend
Beitrag von: Sundtek am April 07, 2012, 11:00:46 Nachmittag
just create 2 files:

Zitat
/usr/bin/tvheadend_restart.sh
#!/bin/bash
/etc/init.d/tvheadend restart

don't forget to chmod 777 /usr/bin/tvheadend_restart.sh

Zitat
/etc/sundtek.conf
device_attach=/usr/bin/tvheadend_restart.sh

that will automatically restart tvheadend when you plug in the USB Stick
Titel: Re:Autostart tvheadend
Beitrag von: rasmus1701 am April 10, 2012, 11:49:24 Vormittag
Thanks - that worked, even for bootup (my USB stick is always plugged in).
Titel: Re:Autostart tvheadend
Beitrag von: tiburcillo am Mai 30, 2012, 01:30:53 Nachmittag
Thanks, this worked for me too!