summaryrefslogtreecommitdiff
path: root/community-testing/mythtv/mythbackend.rc
diff options
context:
space:
mode:
authorNicolás Reynolds <fauno@kiwwwi.com.ar>2012-07-10 18:23:51 -0300
committerNicolás Reynolds <fauno@kiwwwi.com.ar>2012-07-10 18:23:51 -0300
commit38b5b952ddc3b86560fc02e98105bf5826d25354 (patch)
tree0e689740cb7cc4cf171a6c962e623dbe7e53fc64 /community-testing/mythtv/mythbackend.rc
parent1146fc0894bfda25180d63716029aabfa7ce017a (diff)
parent0615a909b089a81d068ae10517ceff31dabfece1 (diff)
Merge branch 'master' of ssh://vparabola/home/parabola/abslibre-pre-mips64el
Conflicts: community-staging/performous/PKGBUILD community-testing/oss/PKGBUILD community-testing/picard/PKGBUILD community/deadbeef/PKGBUILD community/gnash/PKGBUILD community/mplayer2/PKGBUILD community/radvd/PKGBUILD community/tinc/PKGBUILD core/glibc/PKGBUILD core/lvm2/PKGBUILD core/util-linux/PKGBUILD extra/avidemux/PKGBUILD extra/boost/PKGBUILD extra/cppunit/PKGBUILD extra/ffmpeg/PKGBUILD extra/gstreamer0.10-ugly/PKGBUILD extra/kdemultimedia/PKGBUILD extra/kradio/PKGBUILD extra/opal/PKGBUILD extra/pidgin/PKGBUILD extra/postfix/PKGBUILD extra/ptlib/PKGBUILD extra/xine-lib/PKGBUILD kde-unstable/kdebase-workspace/PKGBUILD kde-unstable/kdebase-workspace/kdm.service kde-unstable/kdemultimedia-ffmpegthumbs/PKGBUILD libre/virtualbox-libre/PKGBUILD libre/virtualbox-modules-lts/PKGBUILD multilib-testing/lib32-glibc/PKGBUILD multilib/binutils-multilib/PKGBUILD multilib/gcc-multilib/PKGBUILD multilib/lib32-dbus-core/PKGBUILD multilib/lib32-e2fsprogs/PKGBUILD multilib/lib32-glibc/PKGBUILD multilib/lib32-glibc/glibc-2.15-revert-c5a0802a.patch multilib/lib32-gnutls/PKGBUILD multilib/lib32-libidn/PKGBUILD multilib/lib32-libjpeg-turbo/PKGBUILD multilib/lib32-pixman/PKGBUILD staging/ekiga/PKGBUILD staging/kdeedu-kig/PKGBUILD staging/kdeedu-rocs/PKGBUILD testing/glibc/PKGBUILD testing/kdebase-workspace/PKGBUILD testing/kdebase-workspace/kdm.service testing/nilfs-utils/PKGBUILD testing/systemd/PKGBUILD
Diffstat (limited to 'community-testing/mythtv/mythbackend.rc')
-rw-r--r--community-testing/mythtv/mythbackend.rc73
1 files changed, 73 insertions, 0 deletions
diff --git a/community-testing/mythtv/mythbackend.rc b/community-testing/mythtv/mythbackend.rc
new file mode 100644
index 000000000..488b4cb8e
--- /dev/null
+++ b/community-testing/mythtv/mythbackend.rc
@@ -0,0 +1,73 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/profile
+
+###############################################################################
+# Default values to use if none are supplied in the config file.
+#
+# User who should start the mythbackend process
+MBE_USER='mythtv'
+
+# Startup options for mythbackend
+MBE_OPTS=''
+
+# Directory holding the mythbackend log file
+LOG_PATH='/var/log/mythtv'
+
+# Logging options for mythbackend
+LOG_OPTS=''
+###############################################################################
+
+CONFIG_FILE=/etc/conf.d/mythbackend
+PIDFILE=/var/run/mythbackend.pid
+
+if [[ -r "$CONFIG_FILE" ]]; then
+ . "$CONFIG_FILE"
+fi
+
+PID="$(cat "$PIDFILE" 2> /dev/null || pidof mythbackend)"
+export HOME="$(getent passwd "$MBE_USER" | cut -d : -f 6)"
+
+case "$1" in
+ start)
+ stat_busy "Starting MythTV Backend"
+
+ if [[ "$PID" -gt 0 ]] && kill -0 "$PID"; then
+ stat_fail
+ exit 0
+ fi
+
+ touch "$PIDFILE"
+ chown "$MBE_USER" "$PIDFILE" "$LOG_PATH"
+
+ MBE_CMD="/usr/bin/mythbackend --daemon \
+ --logpath "$LOG_PATH" $LOG_OPTS \
+ --pidfile "$PIDFILE" $MBE_OPTS"
+ if su "$MBE_USER" -c "$MBE_CMD"; 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 -f "$PIDFILE"
+ else
+ stat_fail
+ fi
+ ;;
+ restart)
+ "$0" stop
+ "$0" start
+ ;;
+ *)
+ echo "usage: $0 (start|stop|restart)"
+ ;;
+esac
+exit 0