Jump to content

TVHeadend on OpiPC


Dirk Handzik

Recommended Posts

Thx Dirk, your instructions helped me to run tvheadend on my Orange Pi, however it seems that your init.d script is not completed. Let me show show here updated version of your script:

#!/bin/bash
### BEGIN INIT INFO
# Provides:          tvheadend
# Required-Start:    $local_fs $remote_fs $network
# Required-Stop:     $local_fs $remote_fs $network
# Should-Start:      $syslog
# Should-Stop:       $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1
# Short-Description: start/stop tvheadend Server
### END INIT INFO

TVHNAME="tvheadend"
TVHBIN="/usr/local/bin/tvheadend"
TVHUSER="tvheadend"
TVHGROUP="tvheadend"
PIDFILE=/var/run/$TVHNAME.pid

. /lib/lsb/init-functions 

start() {
    if [ -e $PIDFILE ]; then
        PID=$(ps ax | grep -v grep | grep -w $(cat $PIDFILE) | awk '{print $1}')
        if [ -n "$PID" ]; then
            echo "$TVHNAME already running (pid $PID)."
            exit 1
        fi
    fi
    echo -n "Starting tvheadend: "
    start-stop-daemon --start --background --pidfile $PIDFILE --make-pidfile --user ${TVHUSER} --exec ${TVHBIN} -- \
        -u ${TVHUSER} -g ${TVHGROUP} -f -C
    echo "Done."
}

stop() {
    if [ -e $PIDFILE ]; then
        PID=$(ps ax | grep -v grep | grep -w $(cat $PIDFILE) | awk '{print $1}')
        if [ -n "$PID" ]; then
            echo -n "Stopping $TVHNAME: "
            start-stop-daemon --stop --quiet --pidfile $PIDFILE --name ${TVHNAME}
            echo "Done."
        else
            echo "$TVHNAME is not running."
        fi
    else
        echo "$TVHNAME is not running."
    fi
}

status() {
    if [ -e $PIDFILE ]; then
        PID=$(ps ax | grep -v grep | grep -w $(cat $PIDFILE) | awk '{print $1}')
        if [ -n "$PID" ]; then
            echo "$TVHNAME is running (pid $PID)."
        else
            echo "$TVHNAME is not running."
            [ -e $PIDFILE ] && exit 1 || exit 3
        fi
    fi
}

case "$1" in
  start)
    start
    ;;
  stop)
    stop
    ;;
  status)
    status
    ;;
  restart|reload|force-reload)
	stop
	sleep 2
	start
	;;
  *)
        log_warning_msg "Usage: $0 {start|stop|status|restart|reload|force-reload}" >&2
	exit 1
	;;
esac

exit 0

 

Link to comment
Share on other sites

I followed your instructions but the make command is creating errors.

 

make
Makefile:25: .config.mk: No such file or directory
Makefile:751: /support/.mk: No such file or directory
make: *** No rule to make target '/support/.mk'.  Stop.

any idea?

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines