summaryrefslogtreecommitdiff
path: root/community-testing/mythtv/mythbackend.rc
diff options
context:
space:
mode:
authorNicolas Reynolds <fauno@kiwwwi.com.ar>2011-10-28 11:35:50 -0300
committerNicolas Reynolds <fauno@kiwwwi.com.ar>2011-10-28 11:35:50 -0300
commit8856e6fe26ce35b4caf6beeac324f583ec1b6133 (patch)
treec42a03e2b7610a39d167af36357607399aa40045 /community-testing/mythtv/mythbackend.rc
parent5100458465d1ed420073c3213349bf430075ddbc (diff)
parent0424b5fc47f106db6498c4cda3476e1d49fe0f82 (diff)
Merge branch 'master' of ssh://vparabola/home/parabola/abslibre-pre-mips64el
Conflicts: community/esmtp/PKGBUILD community/geany-plugins/PKGBUILD community/giggle/PKGBUILD community/guichan/PKGBUILD community/mxml/PKGBUILD community/ruby-gtk2/PKGBUILD core/libtool/PKGBUILD core/mkinitcpio-busybox/PKGBUILD core/udev/PKGBUILD extra/audacious/PKGBUILD extra/conky/PKGBUILD extra/gnome-control-center/PKGBUILD extra/gtk2/PKGBUILD extra/gtk3/PKGBUILD extra/gvfs/PKGBUILD extra/kdeutils/PKGBUILD extra/kino/PKGBUILD extra/mkvtoolnix/PKGBUILD extra/poppler/PKGBUILD extra/postfix/PKGBUILD extra/pulseaudio/PKGBUILD extra/qtcurve-gtk2/PKGBUILD extra/transmission/PKGBUILD extra/xfburn/PKGBUILD extra/xfce4-xkb-plugin/PKGBUILD extra/xorg-server/PKGBUILD extra/yelp/PKGBUILD kde-unstable/calligra/PKGBUILD multilib/lib32-gtk2/PKGBUILD multilib/lib32-libpulse/PKGBUILD multilib/libtool-multilib/PKGBUILD multilib/wine/PKGBUILD multilib/wine/wine.install
Diffstat (limited to 'community-testing/mythtv/mythbackend.rc')
-rw-r--r--community-testing/mythtv/mythbackend.rc82
1 files changed, 82 insertions, 0 deletions
diff --git a/community-testing/mythtv/mythbackend.rc b/community-testing/mythtv/mythbackend.rc
new file mode 100644
index 000000000..410e8de41
--- /dev/null
+++ b/community-testing/mythtv/mythbackend.rc
@@ -0,0 +1,82 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+# Default values to use if none are supplied in the config file.
+
+# Running mythbackend as non-root requires you to ensure that audio/video
+# devices used for recording have suitable user permissions. One way
+# to achieve this is to modify existing or create new udev rules which
+# assign these devices to a non-root group with rw permissions and add
+# your mythbackend user to that group. Be aware that console.perms can
+# also affect device permissions and may need additional configuration.
+# Running as non-root may also introduce increased process latency.
+#
+# User who should start the mythbackend processes
+MBE_USER='root'
+
+# Startup options for mythbackend
+MBE_OPTIONS=''
+
+# Name of mythbackend log file
+LOG_FILE='/var/log/mythbackend.log'
+
+# Logging options for mythbackend (empty means '-v important,general')
+LOG_OPTS=''
+
+###############################################################################
+
+CONFIG_FILE=/etc/conf.d/mythbackend
+PIDFILE=/var/run/mythbackend.pid
+
+if [[ -f ${CONFIG_FILE} ]]; then
+ . ${CONFIG_FILE}
+fi
+
+pid="$(cat ${PIDFILE} 2>/dev/null || pidof mythbackend)";
+
+# fix FS#11890
+mbe_user_home="$(getent passwd ${MBE_USER}|cut -d : -f 6)"
+
+case "$1" in
+ start)
+ stat_busy "Starting MythTV Backend"
+
+ # already running ?
+ if [[ "${pid}" -gt 0 ]] && kill -0 "${pid}"; then
+ stat_fail
+ exit 1;
+ fi
+ touch ${PIDFILE} ${LOG_FILE}
+ chown "$MBE_USER" ${PIDFILE} ${LOG_FILE}
+ if su "$MBE_USER" -c "HOME=${mbe_user_home} mythbackend \
+ --daemon \
+ --logfile $LOG_FILE $LOG_OPTS \
+ --pidfile ${PIDFILE} $MBE_OPTIONS";
+ then
+ add_daemon mythbackend
+ stat_done
+ else
+ stat_fail
+ fi
+ ;;
+
+ stop)
+ stat_busy "Stopping MythTV Backend"
+ if [[ "${pid}" -gt 0 ]] && kill $pid &>/dev/null; then
+ rm_daemon mythbackend
+ stat_done
+ rm ${PIDFILE} 2>/dev/null
+ else
+ stat_fail
+ fi
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0