summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'media-tv/mythtv/files/mythbackend.init-r2')
-rw-r--r--media-tv/mythtv/files/mythbackend.init-r270
1 files changed, 70 insertions, 0 deletions
diff --git a/media-tv/mythtv/files/mythbackend.init-r2 b/media-tv/mythtv/files/mythbackend.init-r2
new file mode 100644
index 000000000000..43f53e876ff4
--- /dev/null
+++ b/media-tv/mythtv/files/mythbackend.init-r2
@@ -0,0 +1,70 @@
+#!/sbin/runscript
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+description="MythTV backend recording daemon"
+extra_commands="resched upnprebuild"
+description_resched="Forces the recording scheduler to update"
+description_upnprebuild="Rebuilds the UPnP media cache"
+
+depend() {
+ # mythbackend doesn't need to run on the same machine that
+ # mysql runs on. so its use for that reason
+ use logger net.lo mysql LCDd
+}
+
+start() {
+ local logging=
+
+ [ -z "${MYTHBACKEND_VERBOSE}" ] && \
+ MYTHBACKEND_VERBOSE="general"
+ [ -z "${MYTHBACKEND_LOGGING}" ] && \
+ MYTHBACKEND_LOGGING="files"
+ case "${MYTHBACKEND_LOGGING}" in
+ database) logging="--enable-dblog" ;;
+ syslog\ *) logging="--${MYTHBACKEND_LOGGING}" ;;
+ files) logging="--logpath /var/log/mythtv" ;;
+ console) logging="--nologserver" ;;
+ *)
+ eerror "Invalid MYTHBACKEND_LOGGING value"
+ exit 1
+ ;;
+ esac
+
+ #fixes for bug #101308
+ unset DISPLAY
+ unset SESSION_MANAGER
+
+ # Work around any strange permissions that may be on these files.
+ [ "x${MYTHBACKEND_LOGGING}" = "xfiles" ] && \
+ checkpath --directory --owner mythv:video --mode 0775 /var/log/mythtv
+ checkpath --directory --owner mythv:video --mode 0775 /home/mythtv
+
+ ebegin "Starting MythTV Backend"
+ start-stop-daemon --start --quiet --exec /usr/bin/mythbackend \
+ --pidfile /var/run/mythbackend.pid --user mythtv:video -- \
+ --daemon --pidfile /var/run/mythbackend.pid \
+ --verbose ${MYTHBACKEND_VERBOSE} \
+ ${logging} ${MYTHBACKEND_OPTS}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping MythTV Backend"
+ start-stop-daemon --stop --retry 10 --progress \
+ --pidfile=/var/run/mythbackend.pid
+ eend $?
+}
+
+resched() {
+ ebegin "Updating the recording scheduler"
+ /usr/bin/mythbackend --resched
+ eend $?
+}
+
+upnprebuild() {
+ ebegin "Rebuilding UPnP media cache"
+ /usr/bin/mythbackend --upnprebuild
+ eend $?
+}