Sophie

Sophie

distrib > Mageia > 4 > i586 > media > core-release > by-pkgid > 16e8301c2957ef5009c559d4f9e1d46b > files > 2

mythtv-backend-0.27-20131222.2.mga4.i586.rpm

#!/bin/bash
#
# Startup script for mythbackend
#
# chkconfig: 2345 86 14
# description: mythbackend.
# processname: mythbackend
# pidfile: /var/run/mythbackend.pid
# config: 

### BEGIN INIT INFO
# Provides: mythbackend
# Required-Start: $network
# Required-Stop: $network
# Should-Start: mysqld
# Should-Stop: mysqld
# Default-Start: 2 3 4 5
# Short-Description: MythTV backend
# Description: MythTV backend
### END INIT INFO

# Source function library.
. /etc/rc.d/init.d/functions

if [ -f /etc/sysconfig/mythbackend ]; then
        . /etc/sysconfig/mythbackend
fi

## Defaults, override them in /etc/sysconfig/mythbackend
: ${MYTHTV_HOME=/var/lib/mythtv}

binary=/usr/bin/mythbackend
prog=mythbackend
RETVAL=0
OPTIONS="$OPTIONS --daemon --logpath /var/log/mythtv --pidfile /var/run/$prog.pid"

start() {
  gprintf "Starting %s: " "$prog"
  touch /var/run/mythbackend.pid; chown mythtv:mythtv /var/run/mythbackend.pid
  cd $MYTHTV_HOME && daemon --user mythtv $binary $OPTIONS
  RETVAL=$?
  echo
  [ $RETVAL = 0 ] && touch /var/lock/subsys/$prog
  return $RETVAL
}

stop() {
  gprintf "Stopping %s: " "$prog"
  killproc $binary
  RETVAL=$?
  echo
  [ $RETVAL = 0 ] && rm -f /var/lock/subsys/$prog /var/run/$prog.pid
}

# See how we were called.
case "$1" in
  start)
	start
	;;
  stop)
	stop
	;;
  restart)
	stop
	start
	;;
  status)
	status $prog
	;;
  *)
	gprintf "Usage: %s {start|stop|status|restart}\n" "$prog"
	exit 1
esac

exit $RETVAL