[mythtv-users] mythbackend startup script for Debian
Peter Schachte
schachte at csse.unimelb.edu.au
Mon Dec 12 05:29:51 EST 2005
On Mon, Dec 12, 2005 at 09:33:19AM +0100, Marius Schrecker wrote:
> I'm having a hard time setting up a startup script on Debian unstable
> using svn from a few days ago.
>
> The sample scripts in the contrib directory of the source don't use Debian
> controls, and as mythbackend has a builtin daemon mode I'm not sure I
> should use a script based on skeleton.
Here's the script I'm using. Works for me on Debian sid, svn 80xx.
You'll want to (as root) move it to /etc/init.d/mythtv-backend and
then (also as root) do:
update-rc.d mythtv-backend start 80 2 3 4 5 . stop 80 0 1 6 .
mkdir -p /var/log/mythtv
chown mythtv:mythtv /var/log/mythtv
chmod 700 /var/log/mythtv
You may have to edit the script to change the value for DAEMON,
depending on where you've installed the binary.
I'm also attaching mythtv-backend.default, which you should move to
/etc/default/mythtv-backend . You can edit it to control the way the
backend is launched.
HTH.
--
Peter Schachte And there's no doubt in my mind, not one doubt in
schachte at cs.mu.OZ.AU my mind, that we will fail. Failure is not a part
www.cs.mu.oz.au/~schachte/ of our vocabulary.
Phone: +61 3 8344 1338 -- George W. Bush
-------------- next part --------------
#! /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
# Added by PDS because backend wasn't starting correctly on boot
HOME=/root
export HOME
if [ -f /etc/default/mythtv-backend ]; then
. /etc/default/mythtv-backend
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
-------------- next part --------------
# User as which to run
#USER=mythtv
# Replace all arguments to mythtv-backend
#ARGS=""
# Append additional arguments
#EXTRA_ARGS="--verbose"
# Set priority
#NICE=-10
More information about the mythtv-users
mailing list