init script

Jake Graft pointed out in a comment that I had forgotten to put the init script from the MythTV book online. My apologies.

#! /bin/sh
#
# mythbackend
#

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

BACKEND=/usr/local/bin/mythbackend
BACKEND_NAME=mythbackend

MYTHUSER="myth"

test -x $BACKEND || exit 0

set -e

case "$1" in
  start)
        echo -n "Starting MythTV: $BACKEND_NAME"
        su ${MYTHUSER} -c "$BACKEND -v all -d -l ${MBE_LOGFILE}" &
        echo "."
        ;;
  stop)
        echo -n "Stopping MythTV: $BACKEND_NAME"
        killall $BACKEND
        echo "."
        ;;
  *)
        echo "Usage: $0 {start|stop}" >&2
        exit 1
        ;;
esac

exit 0