69 lines
1.4 KiB
Plaintext
69 lines
1.4 KiB
Plaintext
|
#!/bin/bash
|
||
|
#
|
||
|
# Startup script for mythbackend
|
||
|
#
|
||
|
# chkconfig: - 86 14
|
||
|
# description: mythbackend.
|
||
|
# processname: mythbackend
|
||
|
# pidfile: /var/run/mythbackend.pid
|
||
|
# config:
|
||
|
|
||
|
# Source function library.
|
||
|
. /etc/init.d/functions
|
||
|
|
||
|
if [ -f /etc/sysconfig/mythbackend ]; then
|
||
|
. /etc/sysconfig/mythbackend
|
||
|
fi
|
||
|
|
||
|
## Defaults, override them in /etc/sysconfig/mythbackend
|
||
|
: ${MYTHTV_HOME=/etc/mythtv}
|
||
|
|
||
|
binary=/usr/bin/mythbackend
|
||
|
prog=mythbackend
|
||
|
RETVAL=0
|
||
|
OPTIONS="$OPTIONS --daemon --logfile /var/log/mythtv/$prog.log --pidfile /var/run/$prog.pid"
|
||
|
# Would be nice to run as non-root, but it doesn't work -- dvb/v4l devices owned by root become unusable
|
||
|
#OPTIONS="$OPTIONS --daemon --user mythtv --logfile /var/log/mythtv/$prog.log --pidfile /var/run/$prog.pid"
|
||
|
|
||
|
start() {
|
||
|
echo -n $"Starting $prog: "
|
||
|
touch /var/run/mythbackend.pid; chown mythtv:mythtv /var/run/mythbackend.pid
|
||
|
export MYTHCONFDIR="$MYTHTV_HOME"
|
||
|
export HOME="$MYTHTV_HOME"
|
||
|
daemon $binary $OPTIONS
|
||
|
RETVAL=$?
|
||
|
echo
|
||
|
[ $RETVAL = 0 ] && touch /var/lock/subsys/$prog
|
||
|
return $RETVAL
|
||
|
}
|
||
|
|
||
|
stop() {
|
||
|
echo -n $"Stopping $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
|
||
|
;;
|
||
|
reload|restart)
|
||
|
stop
|
||
|
start
|
||
|
;;
|
||
|
status)
|
||
|
status $prog
|
||
|
RETVAL=$?
|
||
|
;;
|
||
|
*)
|
||
|
echo $"Usage: $prog {start|stop|status|restart}"
|
||
|
exit 1
|
||
|
esac
|
||
|
|
||
|
exit $RETVAL
|