[mythtv-users] Automatically starting Myth Backend on SuSe 9.2
leith
techie at eleith.com
Fri May 6 08:31:11 UTC 2005
i have attached my init file for SuSe 9.2 mythbackend
i believe I modified [if any] a file from myth's contrib/ directory.
after you put it in /etc/init.d run chkconfig mythbacked 235 so that it
will autostart on those runlevels.
-leith
Mitko Haralanov wrote:
> On Thu, 5 May 2005 23:33:50 -0700
> "Andrew Chung" <acchung at techie.com> wrote:
>
>
>>Has anyone gotten mythbackend to start correctly through init.d scripts on
>>SuSe 9.2?
>
>
> From my experience with SuSE, the Required-Start members should not
> have the $, like:
>
> # Required-Start: mysql network local_fs remote_fs
>
> I know that the files that come with SuSE all have them but at work we
> are using one of these files and we had to remove the $'s to get it to
> work
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> mythtv-users mailing list
> mythtv-users at mythtv.org
> http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users
-------------- next part --------------
#!/bin/sh
### BEGIN INIT INFO
# Provides: mythbackend
# Required-Start: $network $remote_fs mysql
# Required-Stop:
# Default-Start: 2 3 5
# Default-Stop:
# Description: Start the MythTV backend
### END INIT INFO
# Shell functions sourced from /etc/rc.status:
# rc_check check and set local and overall rc status
# rc_status check and set local and overall rc status
# rc_status -v ditto but be verbose in local rc status
# rc_status -v -r ditto and clear the local rc status
# rc_failed set local and overall rc status to failed
# rc_failed <num> set local and overall rc status to <num>
# rc_reset clear local rc status (overall remains)
# rc_exit exit appropriate to overall rc status
. /etc/rc.status
# First reset status of this service
rc_reset
unset MBE
logdir=/mnt/myth/log
if test -x /usr/bin/mythbackend
then
MBE=/usr/bin/mythbackend
basedir=/usr
bindir=/usr/bin
datadir=/tmp
elif test -x /usr/local/bin/mythbackend
then
MBE=/usr/local/bin/mythbackend
basedir=/usr/local
bindir=/usr/local/bin
datadir=/tmp
elif test -x /opt/mythtv/bin/mythbackend
then
MBE=/opt/mythtv/bin/mythbackend
basedir=/opt/mythtv
bindir=/opt/mythtv/bin
datadir=/opt/mythtv
fi
test "$MBE" || { echo "/usr/bin/mythbackend nor /usr/local/bin/mythbackend nor /opt/mythtv/bin/mythbackend exists"; rc_failed 5; rc_status -v; rc_exit; }
if test -z "$pid_file"
then
pid_file=$datadir/mythbackend.`/bin/hostname`.pid
else
case "$pid_file" in
/* ) ;;
* ) pid_file="$datadir/$pid_file" ;;
esac
fi
mode=$1 # start or stop
# Safeguard (relative paths, core dumps..)
#cd $basedir
cd ~
case "$1" in
start)
# exit gracefully, if we are already running
checkproc $MBE && echo -n "Starting service Myth Backend" && \
rc_status -v && rc_exit
test -x $MBE || { echo "$MBE does not exist"; rc_failed 5; rc_status -v; rc_exit; }
echo "Starting service MythTV Backend"
startproc $MBE -l $logdir/mythbackend.log 2>> $logdir/mythbackend.error.log &
#start up transcoding daemon
/usr/local/bin/mtd -d
#start up lcdproc daemon
#/usr/src/mythtv-.17/lcdproc-0.4.5/server/LCDd
#set right path
PATH=$PATH:/usr/local/bin
export PATH
# Rmember status and be verbose
rc_status -v
;;
stop)
echo "Shutting down service MythTV Backend"
killproc -p $pid_file -TERM $MBE
# Remember status and be verbose
rc_status -v
;;
try-restart)
## Stop the service and if this succeeds (i.e. the
## service was running before), start it again.
## Note: try-restart is not (yet) part of LSB (as of 0.7.5)
$0 status >/dev/null && $0 restart
# Remember status and be quiet
rc_status
;;
restart|force-reload)
echo "Restarting service MythTV Backend"
$0 stop
$0 start
rc_status
;;
reload)
echo -n "Reloading service MythTV Backend"
killproc -p $pid_file -HUP $MBE
touch $pid_file
rc_status -v
;;
check|status)
echo -n "Checking for service MythTV BackendL: "
## Check status with checkproc(8), if process is running
## checkproc will return with exit status 0.
# Status has a slightly different for the status command:
# 0 - service running
# 1 - service dead, but /var/run/ pid file exists
# 2 - service dead, but /var/lock/ lock file exists
# 3 - service not running
# NOTE: checkproc returns LSB compliant status values.
checkproc $MBE
rc_status -v
;;
*)
echo "Usage: $0 {start|stop|status|reload|restart|try-restart|force-reload}"
exit 1
;;
esac
rc_exit
More information about the mythtv-users
mailing list