#!/bin/sh # # mythbackend Server component of MythTV # # chkconfig: 2345 86 14 # description: Starts the mythbackend process as a daemon after the XWindows \ # system is started, in runlevel 5. This allows scheduled \ # recordings to occur without manual intervention. # processname: mythbackend # pidfile: /var/run/mythtv/mythbackend.pid # config: /etc/sysconfig/mythbackend # Source function library. . /etc/rc.d/init.d/functions MYTHTV_USER=mythtv OPTIONS= if [ -f /etc/sysconfig/mythbackend ]; then . /etc/sysconfig/mythbackend fi pidfile=/var/run/mythtv/mythbackend.pid start() { # Start daemons. if [ -f /var/lock/subsys/mythbackend ]; then msg_already_running "Mythbackend" return fi msg_starting "Mythbackend" daemon /usr/sbin/mythbackend --daemon \ --user $MYTHTV_USER \ --logfile /var/log/mythtv/mythbackend.log \ --pidfile $pidfile \ $OPTIONS RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/mythbackend } stop() { # Stop daemons. if [ ! -f /var/lock/subsys/mythbackend ]; then msg_not_running "Mythbackend" return fi msg_stopping "Mythbackend" killproc --pidfile mythtv/mythbackend.pid mythbackend rm -f /var/lock/subsys/mythbackend $pidfile >/dev/null 2>&1 } condrestart() { if [ ! -f /var/lock/subsys/mythbackend ]; then msg_not_running "Mythbackend" RETVAL=$1 return fi stop start } flush-logs() { if [ ! -f /var/lock/subsys/mythbackend ]; then return fi show "Rotating %s logs" "Mythbackend" killproc --pidfile $pidfile mythbackend -HUP } RETVAL=0 # See how we were called. case "$1" in start) start ;; stop) stop ;; restart) stop start ;; try-restart) condrestart 0 ;; force-reload) condrestart 7 ;; flush-logs) flush-logs ;; status) status --pidfile $pidfile mythbackend ;; *) msg_usage "$0 {start|stop|restart|try-restart|force-reload|flush-logs|status}" exit 3 esac exit $RETVAL