[mythtv-users] running backend as debian runlevel "service"?

Mike stuff at dustsmoke.com
Fri Oct 14 04:09:13 EDT 2005


Steve Adeff wrote:

>I tried setting up mythbackend to run as a debian "service" in init.d/ but 
>when I do so I get errors that don't allow it to record or the frontends to 
>connect. the log files don't seem to show any problems though. I was 
>wondering if anyone else has set this up and how you did it?
>
>thanks,
>Steve
>  
>
I took this from those abandoned debian packages listed in the myth 
documentation. (just modified the paths)

##############################################################################
#! /bin/sh
#
# mythtv-server MythTV capture and encoding backend
#
# Based on:
#
# skeleton      example file to build /etc/init.d/ scripts.
#               This file should be used to construct scripts for 
/etc/init.d.
#
#               Written by Miquel van Smoorenburg <miquels at cistron.nl>.
#               Modified for Debian GNU/Linux
#               by Ian Murdock <imurdock at gnu.ai.mit.edu>.
#
# Version:      @(#)skeleton  1.9.1  08-Apr-2002  miquels at cistron.nl
#

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/local/bin/mythbackend
NAME="mythbackend"
DESC="MythTV server"

test -x $DAEMON || exit 0

set -e

USER=mythtv
RUNDIR=/var/run/mythtv
ARGS="--daemon --logfile /var/log/mythtv/mythbackend.log --pidfile 
$RUNDIR/$NAME.pid"
EXTRA_ARGS=""
NICE=0

if [ -f /etc/default/mythbackend ]; then
  . /etc/default/mythbackend
fi

ARGS="$ARGS $EXTRA_ARGS"

mkdir -p $RUNDIR
chown -R $USER $RUNDIR


case "$1" in
  start)
        echo -n "Starting $DESC: $NAME"
        start-stop-daemon --start --pidfile $RUNDIR/$NAME.pid \
                --chuid $USER --nicelevel $NICE --exec $DAEMON -- $ARGS
        echo "."
        ;;
  stop)
        echo -n "Stopping $DESC: $NAME "
        start-stop-daemon --stop --oknodo --pidfile $RUNDIR/$NAME.pid \
                --chuid $USER --exec $DAEMON -- $ARGS
        echo "."
        ;;
  restart|force-reload)
        echo -n "Restarting $DESC: $NAME"
        start-stop-daemon --stop --oknodo --pidfile $RUNDIR/$NAME.pid \
                --chuid $USER --exec $DAEMON -- $ARGS
        echo "."
        sleep 3
        start-stop-daemon --start --pidfile $RUNDIR/$NAME.pid \
                --chuid $USER --nicelevel $NICE --exec $DAEMON -- $ARGS
        echo "."
        ;;
  *)
        N=/etc/init.d/$NAME
        # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
        echo "Usage: $N {start|stop|restart|force-reload}" >&2
        exit 1
        ;;
esac

exit 0
##############################################################################


More information about the mythtv-users mailing list