2 # tvheadend startup script inspired by the Debian one in the package
4 # Author: Yann E. MORIN <yann.morin.1998@free.fr>
6 PATH
=/usr
/sbin
:/usr
/bin
:/sbin
:/bin
9 PIDFILE
=/var
/run
/$NAME.pid
11 [ -f "${DAEMON}" -a -x "${DAEMON}" ] ||
exit 0
13 # Read configuration variable file if it is present
14 [ -r "/etc/default/${NAME}" ] && .
"/etc/default/${NAME}"
17 [ -z "${TVH_USER}" ] || ARGS="${ARGS} -u ${TVH_USER}"
18 [ -z "${TVH_GROUP}" ] || ARGS="${ARGS} -g ${TVH_GROUP}"
19 [ -z "${TVH_ADAPTERS}" ] || ARGS="${ARGS} -a ${TVH_ADAPTERS}"
20 [ -z "${TVH_HTTP_PORT}" ] || ARGS="${ARGS} -w ${TVH_HTTP_PORT}"
21 [ -z "${TVH_HTSP_PORT}" ] || ARGS="${ARGS} -e ${TVH_HTSP_PORT}"
22 [ "${TVH_DEBUG}" = "1" ] && ARGS
="${ARGS} -s"
24 # If first run, start in wizard mode
25 if [ -z "$(ls -1 /home/tvheadend/.hts/tvheadend/accesscontrol/ 2>/dev/null)" ]; then
31 printf "Starting TVHeadend daemon: "
32 if start-stop-daemon
-S -q -p ${PIDFILE} -m --exec "${DAEMON}" -- ${ARGS}; then
39 printf "Stopping TVHeadend daemon: "
40 start-stop-daemon
-K -q -p ${PIDFILE} -s TERM
42 if start-stop-daemon
-K -q -p ${PIDFILE} -t; then
43 printf "failed, killing: "
44 start-stop-daemon
-K -q -p ${PIDFILE} -s KILL
-o
54 echo "Usage: $0 {start|stop|restart|force-reload}" >&2