[mythtv-users] Gentoo mythfrontend auto-start
Phil Bridges
gravityhammer at gmail.com
Tue Nov 4 02:18:22 UTC 2014
On Mon, Nov 3, 2014 at 6:32 AM, Phil Bridges <gravityhammer at gmail.com>
wrote:
> Thanks, Hiko.
>
> I've put in your scripts (ignoring the lirc stuff, because I don't use
> it), but I'm getting a syntax error:
>
> /etc/init.d/mythfrontend: line 38: syntax error near unexpected token
> `then'
> /etc/init.d/mythfrontend: line 38: ` if [ "$(pgrep -u ${MYTH_UID}
> mythfrontend.re)" ]; then'
>
> Thoughts?
>
> On Mon, Oct 27, 2014 at 3:10 PM, Hika van den Hoven <hikavdh at gmail.com>
> wrote:
>
>> Hoi Phil,
>>
>> Monday, October 27, 2014, 6:58:34 PM, you wrote:
>>
>> > I've recently had to rebuild a couple of my (Gentoo) Myth boxes,
>> > and I'm not sure exactly what I was using for auto-starting
>> > Mythfrontend. What scripts are y'all using for this?
>>
>> I have the following copied from the gentoo-forums and adapted,
>>
>> in /etc/init.d
>>
>> #!/sbin/runscript
>> # Copyright 1999-2006 Gentoo Foundation
>> # Distributed under the terms of the GNU General Public License v2
>> # $Header: $
>>
>> depend() {
>> use mythbackend
>> }
>>
>> start() {
>>
>> ebegin "Starting MythTV Frontend"
>>
>> eindent
>>
>> einfo "Starting mythfrontend"
>>
>> start-stop-daemon --start --quiet --background \
>> --user ${MYTH_UID} \
>> --exec /usr/bin/startx \
>> -- -- ${MYTH_XOPTS} vt${MYTH_VT}
>> eend $?
>>
>> if [ -n "${MYTH_IREXEC}" ]; then
>>
>> local name_opt="${MYTH_IREXEC_NAME:+--name
>> ${MYTH_IREXEC_NAME}}"
>>
>> einfo "Starting irexec"
>> start-stop-daemon --start --quiet \
>> --user ${MYTH_UID} \
>> --exec /usr/bin/irexec \
>> -- --daemon ${name_opt} ${MYTH_LIRCRC}
>> eend $?
>> fi
>>
>> eoutdent
>> }
>>
>> stop() {
>> ebegin "Stopping MythTV Frontend"
>>
>> eindent
>>
>> # Make an assumption here: if there are any of these programs
>> running
>> # under MYTH_UID, then this script started them, and now needs to
>> kill
>> # them.
>>
>> if [ "$(pgrep -u ${MYTH_UID} irexec)" ]; then
>> einfo "Terminating irExec"
>> start-stop-daemon --stop --exec /usr/bin/irexec \
>> --user ${MYTH_UID} --quiet
>> eend $?
>> fi
>>
>> if [ "$(pgrep -u ${MYTH_UID} irxevent)" ]; then
>> einfo "Terminating irXevent"
>> start-stop-daemon --stop --exec /usr/bin/irxevent \
>> --user ${MYTH_UID} --quiet
>> eend $?
>> fi
>>
>> if [ "$(pgrep -u ${MYTH_UID} mythfrontend.re)" ]; then
>> einfo "Terminating MythFrontend"
>> start-stop-daemon --stop --name mythfrontend.re \
>> --user ${MYTH_UID} --quiet
>> eend $?
>> fi
>>
>> if [ "$(pgrep -u ${MYTH_UID} mythlogserver)" ]; then
>> einfo "Terminating mythlogserver"
>> start-stop-daemon --stop --name mythlogserver \
>> --user ${MYTH_UID} --quiet
>>
>> eend $?
>> fi
>>
>> if [ "$(pgrep -u ${MYTH_UID} xclock)" ]; then
>> einfo "Terminating X"
>> start-stop-daemon --stop --name xclock \
>> --user ${MYTH_UID} --quiet
>> eend $?
>> fi
>>
>> eoutdent
>> }
>>
>> in /etc/conf.d
>>
>> # User id that all the processes should run as.
>> MYTH_UID="mythtv"
>>
>> # HOME directory. Needed to find .xinitrc file and .mythtv directory.
>> HOME="/home/${MYTH_UID}"
>>
>> # X runs on the first VT available. At the point this script runs
>> during
>> # system start-up, the gettys haven't started yet, so the first
>> available VT is
>> # VT2. Then, when the getty on VT2 starts, it grabs the keyboard away
>> from X.
>> # To avoid having to turn off gettys in /etc/inittab, tell X where to
>> find an
>> # "unreserved" VT.
>> MYTH_VT="7"
>>
>> # If there are any other X server options you want to use, set them
>> here.
>> MYTH_XOPTS="-nolisten tcp -br"
>>
>> # irexec, part of the lirc package, can be used to run commands in
>> response to
>> # remote control button presses. If this variable is set, then irexec
>> will be
>> # started and pointed to the appropriate config file. Leave this
>> blank or null
>> # to not start irexec.
>> MYTH_IREXEC="yes"
>>
>> # Name that irexec is configured to respond to in the lircrc file.
>> MYTH_IREXEC_NAME="mythtv"
>>
>> # Where irexec can find the lircrc file.
>> MYTH_LIRCRC="${HOME}/.mythtv/lircrc"
>>
>> and ~/.xinitrc
>>
>> # .xinitrc
>> cd
>> [ -x /usr/bin/nvidia-settings ] && /usr/bin/nvidia-settings -l
>> /usr/bin/xset s noblank
>> /usr/bin/xset s off
>> /usr/bin/xset -dpms
>> #~/.screenlayout/set-768x576i.sh
>>
>> /usr/bin/evilwm \
>> -snap 10 -bw 1 \
>> -bg rgb:0/0/3fff -fg rgb:0/0/ffff \
>> -app xclock/XClock -s \
>> -app xterm/XTerm -g 116x41+11+25 \
>> -app xmyth/XTerm -v 0 -g 116x39+11+25 \
>> -app xstart/XTerm -v 2 -g 116x39+11+25 \
>> -app xvnc/XTerm -v 3 -g 116x39+11+25 \
>> -app mythfrontend/Mythfrontend -v 0 &
>>
>> exec /usr/bin/xterm -name "xmyth" \
>> -bg rgb:0/0/3fff \
>> -fg rgb:ffff/ffff/ffff \
>> -e ~/.scripts/StartMyth.sh &
>>
>> exec /usr/bin/xterm -name "xstart" \
>> -xrm "XTerm.vt100.allowSendEvents: true" \
>> -bg rgb:0/0/3fff \
>> -fg rgb:ffff/ffff/ffff \
>> -e /bin/bash &
>>
>> exec /usr/bin/xterm -name "xvnc" \
>> -bg rgb:0/0/3fff \
>> -fg rgb:ffff/ffff/ffff \
>> -e ~/.scripts/StartVnc.sh &
>>
>> exec xclock -digital -padding 2 -norender -g -0+0 \
>> -bg rgb:0/0/3fff \
>> -fg rgb:ffff/ffff/ffff
>>
>> and StartMyth.sh
>>
>> #!/bin/bash
>> while true; do
>> /usr/bin/mythfrontend --syslog local7
>> read x
>> clear
>> done
>>
>> The clock is this way the X-closing application. Running the frontend
>> from an Xterm makes the log with an Alt-tab visible. The loop lets me
>> easily restart. (Actually it has a whole menu with reboot, hibernate
>> etc. options). The vnc script has a similar loop to restart it. The
>> extra xterm is there in place of a normal text terminal. The TV is
>> interlaced vga to scart, so I can't get a normal console other than
>> ssh.
>>
>>
It appears to not like that position of any of the three if/thens.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mythtv.org/pipermail/mythtv-users/attachments/20141103/63d9eaa1/attachment.html>
More information about the mythtv-users
mailing list