All pastes #45005 Raw Edit

Someone

public text v1 · immutable
#45005 ·published 2006-03-09 06:16 UTC
rendered paste body
#!/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 $?
}