Difference between revisions of "Debian init.d mythbackend"

From MythTV Official Wiki
Jump to: navigation, search
 
(Let's merge scripts together. We don't have enough to warrant subcategorizing yet.)
Line 86: Line 86:
  
  
[[Category:Debian init.d Scripts]]
+
[[Category:Scripts]]

Revision as of 18:08, 18 May 2006

Debian /etc/init.d/mythbackend

An init.d script for launching mythbackend using the System V init in Debian.

Script

##############################################################################
#! /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@cistron.nl>.
#               Modified for Debian GNU/Linux
#               by Ian Murdock <imurdock@gnu.ai.mit.edu>.
#               and again by Steve Adeff <adeffs@gmail.com>
#
# Version:      @(#)skeleton  1.9.1  08-Apr-2002  miquels@cistron.nl
#

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
LOCATION=/usr/local/bin
DAEMON=$LOCATION/mythbackend
NAME="mythbackend"
DESC="MythTV Backend"

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="-v all"
NICE=0

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

ARGS="$ARGS $EXTRA_ARGS"

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


case "$1" in
  start)
        echo -n "Starting $DESC: $NAME"
#       /usr/local/bin/plugset2
        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
##############################################################################