2013-08-04, 19:07
After a couple of days toiling with this, I found that tvheadend was the culprit (I've already logged a bug over there as well).
The solution is simple:
1) Replace the existing /etc/init/tvheadend.conf file with this one:
2) Add the following script as /etc/pm/sleep.d/90-tvheadend (make sure it's set as executable):
Please note that the script is smart enough to function even if you don't have "xbmc-send" installed. However, it works best if you install it (xbmc-eventclients-xbmc-send package).
This should clear up any slow reboots/suspends.
Cheers!
The solution is simple:
1) Replace the existing /etc/init/tvheadend.conf file with this one:
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 and started udev-finish)
stop on starting shutdown
setuid xbmc
setgid video
respawn
script
[ -r /etc/default/tvheadend ] && . /etc/default/tvheadend
if [ "$TVH_ENABLED" != "1" ] ; then
stop
exit 0
fi
CONF="$(readlink -f ~xbmc/.hts/tvheadend)"
[ -n "$TVH_CONF_DIR" ] && CONF="$TVH_CONF_DIR"
ARGS="-c ${CONF}"
[ -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"
[ ! -z "$TVH_DELAY" ] && sleep $TVH_DELAY
exec tvheadend $ARGS $TVH_ARGS
end script
2) Add the following script as /etc/pm/sleep.d/90-tvheadend (make sure it's set as executable):
Code:
#!/bin/sh
LOCKFILE="/var/lock/tvheadend.sleep"
STOP_SECS=10
LOGO="/usr/share/tvheadend/docs/docresources/tvheadendlogo.png"
# To install xbmc-send, install the xbmc-eventclients-xbmc-send package
XBMC_SEND="$(which xbmc-send)"
notify() {
[ -z "${XBMC_SEND}" ] && return 0
"${XBMC_SEND}" "$@"
}
get_pid() {
# status tvheadend | grep "start/running" | sed -e 's/^.* //g'
pidof tvheadend
}
do_start() {
start tvheadend &>/dev/null
}
do_stop() {
stop tvheadend &>/dev/null
for seq in $(seq 1 ${STOP_SECS}) ; do
[ -z "$(get_pid)" ] && return 0
sleep 1
done
killall -9 tvheadend &>/dev/null
[ -z "$(get_pid)" ]
}
case "${1}" in
hibernate|suspend)
if [ "$(pidof tvheadend)" ]; then
notify -a "Notification(tvheadend, Shutting down HTS TVHeadend for suspend..., 5000, ${LOGO})"
do_stop
touch "${LOCKFILE}"
exit ${?}
fi
;;
thaw|resume)
if [ -f "${LOCKFILE}" ] ; then
notify -a "Notification(tvheadend, Restarting HTS TVHeadend for wakeup, 5000, ${LOGO})"
do_stop ${STOP_SECS} && rm -f "${LOCKFILE}"
do_start
exit ${?}
fi
;;
esac
exit 0
Please note that the script is smart enough to function even if you don't have "xbmc-send" installed. However, it works best if you install it (xbmc-eventclients-xbmc-send package).
This should clear up any slow reboots/suspends.
Cheers!