My system is booting tvheadened before the usb tuner is ready resulting in error no tuner available...
If I go to terminal after boot and issue "sudo service tvheadend restart" everything works like a champ. I've tried to delay tvheadend at boot but was unable to find any clear instructions. I've tried disableing tvheadeneds autoboot and manually adding it to end of start up but that causes tvheadend to run as root which screw everything up. So I need to know how to make a script that restarts tvheadend after a delay at boot... and where to put it. Never done a script before... thanks!
Mint 17.3 xfce
Custom kernel 3.16 for Hauppauge 1955
Intel J1900
120 gb ssd
2 gigs ram
Kodi 16 started in kodi session at boot
Maybe you could also try to add the user in question to /etc/sudoers and allow it do run that command without asking for a password:
Note:
Do the following at your own risk. Typos might harm your system in a fatal way!!!
Bring up a terminal and edit the file /etc/sudoers with an editor you like (I prefere 'vim' and that's recommended, but 'nano will do it, too)..
Code:
sudo vim /etc/sudoers
Then add your user and allow it to run the specific command without asking for a password:
Code:
'username' ALL = NOPASSWD: '/path/to/some/script'
If you want your user to run ANY command without asking for a password (not recommended):
Code:
'username' ALL = NOPASSWD: ALL
Everything above is just a wild guess and I never did this before. Maybe there is an easier way. So please don't blame if it doesn't work as expected
.
better solution is to use udev to tell your init system that the tuner is ready.
example for vdr using upstart(ubuntu <=14.04):
/etc/udev/rules.d/80-vdr.rules
Code:
#DVB
SUBSYSTEM=="dvb" , KERNEL=="dvb0.frontend0", ACTION=="add", RUN+="/sbin/initctl --quiet emit --no-wait dvb-ready"
/etc/init/vdr.conf
Code:
description "vdr"
start on (local-filesystems
and net-device-up IFACE!=lo
and dvb-ready)
stop on runlevel [!2345]
nice -1
pre-start script
while [ ! -e /dev/dvb/adapter0/frontend0 ]
do
sleep 1
done
end script
script
su -c /usr/local/bin/runvdr vdr > /var/log/vdr/vdr.log 2>&1
end script
the important part here is that upstart will wait with starting until udev has sent the dvb-ready signal.
(2016-02-27, 09:37)wsnipex Wrote: [ -> ]better solution is to use udev to tell your init system that the tuner is ready.
example for vdr using upstart(ubuntu <=14.04):
/etc/udev/rules.d/80-vdr.rules
Code:
#DVB
SUBSYSTEM=="dvb" , KERNEL=="dvb0.frontend0", ACTION=="add", RUN+="/sbin/initctl --quiet emit --no-wait dvb-ready"
/etc/init/vdr.conf
Code:
description "vdr"
start on (local-filesystems
and net-device-up IFACE!=lo
and dvb-ready)
stop on runlevel [!2345]
nice -1
pre-start script
while [ ! -e /dev/dvb/adapter0/frontend0 ]
do
sleep 1
done
end script
script
su -c /usr/local/bin/runvdr vdr > /var/log/vdr/vdr.log 2>&1
end script
the important part here is that upstart will wait with starting until udev has sent the dvb-ready signal.
Beautiful,,, thanks so much worked perfect. I simply copied and pasted your first code and used parts of the second code.
Code:
# tvheadend - DVB/IPTV streaming server
#
# Tvheadend is a TV streaming server for Linux supporting DVB, ATSC, IPTV,
# and Analog video (V4L) as input sources.
description "Tvheadend DVB/IPTV streaming server"
author "Adam Sutton <[email protected]>"
start on (local-filesystems
and net-device-up IFACE!=lo
and dvb-ready)
stop on runlevel [!2345]
nice -1
expect fork
respawn
pre-start script
while [ ! -e /dev/dvb/adapter0/frontend0 ]
do
sleep 1
done
end script
script
[ -r /etc/default/tvheadend ] && . /etc/default/tvheadend
[ "$TVH_ENABLED" = "1" ] || exit 0
ARGS="-f"
[ -z "$TVH_USER" ] || ARGS="$ARGS -u $TVH_USER"
[ -z "$TVH_GROUP" ] || ARGS="$ARGS -g $TVH_GROUP"
[ -z "$TVH_CONF_DIR" ] || ARGS="$ARGS -c $TVH_CONF_DIR"
[ -z "$TVH_ADAPTERS" ] || ARGS="$ARGS -a $TVH_ADAPTERS"
[ "$TVH_IPV6" = "1" ] && ARGS="$ARGS -6"
[ -z "$TVH_HTTP_PORT" ] || ARGS="$ARGS --http_port $TVH_HTTP_PORT"
[ -z "$TVH_HTTP_ROOT" ] || ARGS="$ARGS --http_root $TVH_HTTP_ROOT"
[ -z "$TVH_HTSP_PORT" ] || ARGS="$ARGS --htsp_port $TVH_HTSP_PORT"
[ "$TVH_DEBUG" = "1" ] && ARGS="$ARGS -s"
exec tvheadend $ARGS $TVH_ARGS
end script