<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Nov 3, 2014 at 10:25 PM, Hika van den Hoven <span dir="ltr"><<a href="mailto:hikavdh@gmail.com" target="_blank">hikavdh@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hoi Hika,<br>
<div><div class="h5"><br>
Tuesday, November 4, 2014, 4:19:33 AM, you wrote:<br>
<br>
> Hoi Phil,<br>
<br>
> Tuesday, November 4, 2014, 3:18:22 AM, you wrote:<br>
<br>
>> On Mon, Nov 3, 2014 at 6:32 AM, Phil Bridges <<a href="mailto:gravityhammer@gmail.com">gravityhammer@gmail.com</a>>wrote:<br>
<br>
>> Thanks, Hiko.<br>
<br>
>> I've put in your scripts (ignoring the lirc stuff, because I don't<br>
>> use it), but I'm getting a syntax error:<br>
<br>
>> /etc/init.d/mythfrontend: line 38: syntax error near unexpected token `then'<br>
>> /etc/init.d/mythfrontend: line 38: ` if [ "$(pgrep -u<br>
>> ${MYTH_UID} <a href="http://mythfrontend.re" target="_blank">mythfrontend.re</a>)" ]; then'<br>
<br>
>> Thoughts?<br>
<br>
>> On Mon, Oct 27, 2014 at 3:10 PM, Hika van den Hoven <<a href="mailto:hikavdh@gmail.com">hikavdh@gmail.com</a>> wrote:<br>
<br>
>> Hoi Phil,<br>
>><br>
>> Monday, October 27, 2014, 6:58:34 PM, you wrote:<br>
>><br>
>>> I've recently had to rebuild a couple of my (Gentoo) Myth boxes,<br>
>>> and I'm not sure exactly what I was using for auto-starting<br>
>>> Mythfrontend. What scripts are y'all using for this?<br>
>><br>
>><br>
>> I have the following copied from the gentoo-forums and adapted,<br>
>><br>
>> in /etc/init.d<br>
>><br>
>> #!/sbin/runscript<br>
>> # Copyright 1999-2006 Gentoo Foundation<br>
>> # Distributed under the terms of the GNU General Public License v2<br>
>> # $Header: $<br>
>><br>
>> depend() {<br>
>> use mythbackend<br>
>> }<br>
>><br>
>> start() {<br>
>><br>
>> ebegin "Starting MythTV Frontend"<br>
>><br>
>> eindent<br>
>><br>
>> einfo "Starting mythfrontend"<br>
>><br>
>> start-stop-daemon --start --quiet --background \<br>
>> --user ${MYTH_UID} \<br>
>> --exec /usr/bin/startx \<br>
>> -- -- ${MYTH_XOPTS} vt${MYTH_VT}<br>
>> eend $?<br>
>><br>
>> if [ -n "${MYTH_IREXEC}" ]; then<br>
>><br>
>> local name_opt="${MYTH_IREXEC_NAME:+--name ${MYTH_IREXEC_NAME}}"<br>
>><br>
>> einfo "Starting irexec"<br>
>> start-stop-daemon --start --quiet \<br>
>> --user ${MYTH_UID} \<br>
>> --exec /usr/bin/irexec \<br>
>> -- --daemon ${name_opt} ${MYTH_LIRCRC}<br>
>> eend $?<br>
>> fi<br>
>><br>
>> eoutdent<br>
>> }<br>
>><br>
>> stop() {<br>
>> ebegin "Stopping MythTV Frontend"<br>
>><br>
>> eindent<br>
>><br>
>> # Make an assumption here: if there are any of these programs running<br>
>> # under MYTH_UID, then this script started them, and now needs to kill<br>
>> # them.<br>
>><br>
>> if [ "$(pgrep -u ${MYTH_UID} irexec)" ]; then<br>
>> einfo "Terminating irExec"<br>
>> start-stop-daemon --stop --exec /usr/bin/irexec \<br>
>> --user ${MYTH_UID} --quiet<br>
>> eend $?<br>
>> fi<br>
>><br>
>> if [ "$(pgrep -u ${MYTH_UID} irxevent)" ]; then<br>
>> einfo "Terminating irXevent"<br>
>> start-stop-daemon --stop --exec /usr/bin/irxevent \<br>
>> --user ${MYTH_UID} --quiet<br>
>> eend $?<br>
>> fi<br>
>><br>
>> if [ "$(pgrep -u ${MYTH_UID} <a href="http://mythfrontend.re" target="_blank">mythfrontend.re</a>)" ]; then<br>
>> einfo "Terminating MythFrontend"<br>
>> start-stop-daemon --stop --name <a href="http://mythfrontend.re" target="_blank">mythfrontend.re</a> \<br>
>> --user ${MYTH_UID} --quiet<br>
>> eend $?<br>
>> fi<br>
>><br>
>> if [ "$(pgrep -u ${MYTH_UID} mythlogserver)" ]; then<br>
>> einfo "Terminating mythlogserver"<br>
>> start-stop-daemon --stop --name mythlogserver \<br>
>> --user ${MYTH_UID} --quiet<br>
>><br>
>> eend $?<br>
>> fi<br>
>><br>
>> if [ "$(pgrep -u ${MYTH_UID} xclock)" ]; then<br>
>> einfo "Terminating X"<br>
>> start-stop-daemon --stop --name xclock \<br>
>> --user ${MYTH_UID} --quiet<br>
>> eend $?<br>
>> fi<br>
>><br>
>> eoutdent<br>
>> }<br>
>><br>
>> in /etc/conf.d<br>
>><br>
>> # User id that all the processes should run as.<br>
>> MYTH_UID="mythtv"<br>
>><br>
>> # HOME directory. Needed to find .xinitrc file and .mythtv directory.<br>
>> HOME="/home/${MYTH_UID}"<br>
>><br>
>> # X runs on the first VT available. At the point this script runs during<br>
>> # system start-up, the gettys haven't started yet, so the first available VT is<br>
>> # VT2. Then, when the getty on VT2 starts, it grabs the keyboard away from X.<br>
>> # To avoid having to turn off gettys in /etc/inittab, tell X where to find an<br>
>> # "unreserved" VT.<br>
>> MYTH_VT="7"<br>
>><br>
>> # If there are any other X server options you want to use, set them here.<br>
>> MYTH_XOPTS="-nolisten tcp -br"<br>
>><br>
>> # irexec, part of the lirc package, can be used to run commands in response to<br>
>> # remote control button presses. If this variable is set, then irexec will be<br>
>> # started and pointed to the appropriate config file. Leave this blank or null<br>
>> # to not start irexec.<br>
>> MYTH_IREXEC="yes"<br>
>><br>
>> # Name that irexec is configured to respond to in the lircrc file.<br>
>> MYTH_IREXEC_NAME="mythtv"<br>
>><br>
>> # Where irexec can find the lircrc file.<br>
>> MYTH_LIRCRC="${HOME}/.mythtv/lircrc"<br>
>><br>
>> and ~/.xinitrc<br>
>><br>
>> # .xinitrc<br>
>> cd<br>
>> [ -x /usr/bin/nvidia-settings ] && /usr/bin/nvidia-settings -l<br>
>> /usr/bin/xset s noblank<br>
>> /usr/bin/xset s off<br>
>> /usr/bin/xset -dpms<br>
>> #~/.screenlayout/set-768x576i.sh<br>
>><br>
>> /usr/bin/evilwm \<br>
>> -snap 10 -bw 1 \<br>
>> -bg rgb:0/0/3fff -fg rgb:0/0/ffff \<br>
>> -app xclock/XClock -s \<br>
>> -app xterm/XTerm -g 116x41+11+25 \<br>
>> -app xmyth/XTerm -v 0 -g 116x39+11+25 \<br>
>> -app xstart/XTerm -v 2 -g 116x39+11+25 \<br>
>> -app xvnc/XTerm -v 3 -g 116x39+11+25 \<br>
>> -app mythfrontend/Mythfrontend -v 0 &<br>
>><br>
>> exec /usr/bin/xterm -name "xmyth" \<br>
>> -bg rgb:0/0/3fff \<br>
>> -fg rgb:ffff/ffff/ffff \<br>
>> -e ~/.scripts/StartMyth.sh &<br>
>><br>
>> exec /usr/bin/xterm -name "xstart" \<br>
>> -xrm "XTerm.vt100.allowSendEvents: true" \<br>
>> -bg rgb:0/0/3fff \<br>
>> -fg rgb:ffff/ffff/ffff \<br>
>> -e /bin/bash &<br>
>><br>
>> exec /usr/bin/xterm -name "xvnc" \<br>
>> -bg rgb:0/0/3fff \<br>
>> -fg rgb:ffff/ffff/ffff \<br>
>> -e ~/.scripts/StartVnc.sh &<br>
>><br>
>> exec xclock -digital -padding 2 -norender -g -0+0 \<br>
>> -bg rgb:0/0/3fff \<br>
>> -fg rgb:ffff/ffff/ffff<br>
>><br>
>> and StartMyth.sh<br>
>><br>
>> #!/bin/bash<br>
>> while true; do<br>
>> /usr/bin/mythfrontend --syslog local7<br>
>> read x<br>
>> clear<br>
>> done<br>
>><br>
>> The clock is this way the X-closing application. Running the frontend<br>
>> from an Xterm makes the log with an Alt-tab visible. The loop lets me<br>
>> easily restart. (Actually it has a whole menu with reboot, hibernate<br>
>> etc. options). The vnc script has a similar loop to restart it. The<br>
>> extra xterm is there in place of a normal text terminal. The TV is<br>
>> interlaced vga to scart, so I can't get a normal console other than<br>
>> ssh.<br>
>><br>
>> It appears to not like that position of any of the three if/thens. <br>
<br>
> Sorry I didn't react, I apparently didn't get your earlier mail.<br>
<br>
> What do you get if you run pgrep on the command line? (Pgrep is a<br>
> combination of ps and grep. pgrep <name> is the same as ps -A | grep<br>
> <name> where -u ${MYTH_UID} filters on processes owned by ${MYTH_UID})<br>
<br>
> I think your error comes from "$(pgrep -u ${MYTH_UID}<br>
> <a href="http://mythfrontend.re" target="_blank">mythfrontend.re</a>)" giving an unexpected result, most probable because<br>
> the MYTH_UID you have defined in /ect/conf.d/mythfrontend doesn't<br>
> exist. In my script the user is mythtv, so either you change it to<br>
> another user or if it doesn't exists create it. Also the user needs a<br>
> correct user directory etc.<br>
<br>
</div></div>Another possibility comes to mind. Did you mistype MYTH_UID in<br>
/ect/conf.d/mythfrontend? If so the variable is empty and it takes<br>
<a href="http://mythfrontend.re" target="_blank">mythfrontend.re</a> as the username and complains about an invalid<br>
username and a missing argument.<br>
<div class=""><div class="h5"><br></div></div></blockquote><div><br></div><div>Thank for the response, Hika.</div><div><br></div><div>pgrep -u mythtv <a href="http://mythfrontend.re">mythfrontend.re</a></div><div><br></div><div>returns no error (I don't have mythfrontend running at the time, so it returns nothing)</div><div><br></div><div>In conf.d, I have:</div><div><br></div><div><div># User id that all the processes should run as.</div><div>MYTH_UID="mythtv"</div></div><div><br></div><div>mythtv is a valid user, and the home directory is there. Also, if the MYTHUID were bad, wouldn't the init.d script bomb in here?</div><div><br></div><div><div> start-stop-daemon --start --quiet --background \</div><div> --user ${MYTH_UID} \</div><div> --exec /usr/bin/startx \</div><div> -- -- ${MYTH_XOPTS} vt${MYTH_VT}</div></div><div><br></div><div><br></div></div></div></div>