[mythtv-users] running backend as debian runlevel "service"?
Robert Denier
denier at umr.edu
Fri Oct 14 06:00:13 EDT 2005
I'm not sure if this helps, but this is Gentoo's Script. I also
included the /etc/conf.d/mythbackend file. This is the first I noticed
that there was an option to run Myth as another user than root. Since
this is a dedicated box, there shouldn't be a great need to do so, but
it might be something to look into...
-----
mythbackend ~ # cat /etc/init.d/mythbackend
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/media-tv/mythtv/files/0.18-mythbackend.rc,v 1.3 2005/05/22 22:43:19 cardoe Exp $
depend() {
need net
use mysql
}
checkconfig() {
if [ ${MYTH_USER} != "root" ]; then
for i in $(groups "${MYTH_USER/:*/}") ; do
[[ "${i}" == "audio" ]] && audio="yes"
[[ "${i}" == "video" ]] && video="yes"
done
if [ -z "${audio}" -o -z "${video}" ] ; then
ewarn ""
[[ -z "${audio}" ]] && \
ewarn "${HILITE}${MYTH_USER/:*/}${NORMAL} is not in the audio group"
[[ -z "${video}" ]] && \
ewarn "${HILITE}${MYTH_USER/:*/}${NORMAL} is not in the video group"
ewarn ""
ewarn "insufficient permissions discovered"
ewarn "mythbackend may not start correctly"
ewarn ""
fi
fi
}
start() {
[[ -z "${MYTH_USER}" ]] && MYTH_USER="nobody"
[[ -z "${MYTH_NICE}" ]] && MYTH_NICE="0"
[[ -z "${MYTH_VERBOSE}" ]] && MYTH_VERBOSE="none"
checkconfig
HOME="/var/log/mythtv/"
QTDIR=/usr/qt/3
# Work around any strange permissions that may be on these files.
chown -R "${MYTH_USER}" /var/log/mythtv/
ebegin "Starting MythTV Backend"
start-stop-daemon --start --quiet --chuid "${MYTH_USER}" \
--exec /usr/bin/mythbackend --nicelevel "${MYTH_NICE}" \
--make-pidfile --pidfile /var/run/mythbackend.pid \
--background -- --verbose ${MYTH_VERBOSE} \
--logfile /var/log/mythtv/mythbackend.log
eend $?
}
stop () {
ebegin "Stopping MythTV Backend"
start-stop-daemon --stop --quiet --pidfile=/var/run/mythbackend.pid
eend $?
}
--------------------------
mythbackend ~ # cat /etc/conf.d/mythbackend
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
#
$Header: /var/cvsroot/gentoo-x86/media-tv/mythtv/files/0.18-mythbackend.conf,v 1.2 2005/05/14 17:10:03 cardoe Exp $
# Specify which user to run as
#
# NOTE: this user must have permissions to write
# to the LOG and PID directories specified
# below. Furthermore, this user must be able
# to write to the audio and video devices
# that are configured in MythTV. This can
# be achieved by adding this user to the
# audio and video groups.
MYTH_USER=root
# Specify debug-level in log.
# Accepts any combination (separated by comma) of:
# all,none,quiet,record,playback,channel,osd,file,
# schedule,network,commflag,audio,libav,jobqueue
#MYTH_VERBOSE="none"
# Set the nice level (see nice(1)). To give mythbackend a higher
# priority, you may want to set this to -15.
#MYTH_NICE="0"
On Fri, 2005-10-14 at 01:09 -0700, Mike wrote:
> 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
> ##############################################################################
> _______________________________________________
> mythtv-users mailing list
> mythtv-users at mythtv.org
> http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users
>
More information about the mythtv-users
mailing list