Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: MythTV: Users

Start frontend from irexec

 

 

MythTV users RSS feed   Index | Next | Previous | View Threaded


josu.lazkano at gmail

May 5, 2012, 12:54 PM

Post #1 of 6 (672 views)
Permalink
Start frontend from irexec

Hello all, I am trying to configure my remote to start the frontend.

I am using gnome on my system, I read this wiki page:
http://www.mythtv.org/wiki/Frontend_Loading_Script

I try lots of configuration but I can not start from the desktop, this
is my script:

#!/bin/sh

if [ ! "$(pidof mythfrontend)" ]
then
echo "Mythfrontend is not started. Starting Mythfrontend..."
#DISPLAY=:0 xset -dpms
#DISPLAY=:0 mythfrontend 2>&1 &
mythfrontend
else
echo "Mythfrontend is already started. Stoping Mythfrontend..."
killall mythfrontend
fi

exit 0

It stop the frontend well, but it doesn't start. It works well if I
execute from a terminal. But i want to execute without a terminal.

Anyone with this setup?

Best regards.

--
Josu Lazkano
_______________________________________________
mythtv-users mailing list
mythtv-users [at] mythtv
http://www.mythtv.org/mailman/listinfo/mythtv-users


raymond at wagnerrp

May 5, 2012, 12:58 PM

Post #2 of 6 (651 views)
Permalink
Re: Start frontend from irexec [In reply to]

On 5/5/2012 15:54, Josu Lazkano wrote:
> #DISPLAY=:0 mythfrontend 2>&1&
> mythfrontend
>
>
> It stop the frontend well, but it doesn't start. It works well if I
> execute from a terminal. But i want to execute without a terminal.

Chances are you're trying to run the frontend without an X server to
use. If you configured it to log somewhere, it would tell you what the
problem was.
_______________________________________________
mythtv-users mailing list
mythtv-users [at] mythtv
http://www.mythtv.org/mailman/listinfo/mythtv-users


josu.lazkano at gmail

May 5, 2012, 1:21 PM

Post #3 of 6 (654 views)
Permalink
Re: Start frontend from irexec [In reply to]

2012/5/5 Raymond Wagner <raymond [at] wagnerrp>:
> On 5/5/2012 15:54, Josu Lazkano wrote:
>>
>>         #DISPLAY=:0 mythfrontend 2>&1&
>>         mythfrontend
>>
>>
>>
>> It stop the frontend well, but it doesn't start. It works well if I
>> execute from a terminal. But i want to execute without a terminal.
>
>
> Chances are you're trying to run the frontend without an X server to use.
>  If you configured it to log somewhere, it would tell you what the problem
> was.

Thanks Raymond, I try with this:

DISPLAY=:0 xset -dpms
DISPLAY=:0 mythfrontend > /home/lazkano/mythfrontend.log 2>&1 &

And this is the log file:

$ cat mythfrontend.log
No protocol specified
mythfrontend: cannot connect to X server :0

I never configure the X server. How could I configure?

Thanks for your reply.

Regards.

--
Josu Lazkano
_______________________________________________
mythtv-users mailing list
mythtv-users [at] mythtv
http://www.mythtv.org/mailman/listinfo/mythtv-users


mtdean at thirdcontact

May 5, 2012, 1:36 PM

Post #4 of 6 (653 views)
Permalink
Re: Start frontend from irexec [In reply to]

On 05/05/2012 04:21 PM, Josu Lazkano wrote:
> 2012/5/5 Raymond Wagner:
>> On 5/5/2012 15:54, Josu Lazkano wrote:
>>> #DISPLAY=:0 mythfrontend 2>&1&
>>> mythfrontend
>>>
>>>
>>>
>>> It stop the frontend well, but it doesn't start. It works well if I
>>> execute from a terminal. But i want to execute without a terminal.
>>
>> Chances are you're trying to run the frontend without an X server to use.
>> If you configured it to log somewhere, it would tell you what the problem
>> was.
> Thanks Raymond, I try with this:
>
> DISPLAY=:0 xset -dpms
> DISPLAY=:0 mythfrontend> /home/lazkano/mythfrontend.log 2>&1&
>
> And this is the log file:
>
> $ cat mythfrontend.log
> No protocol specified
> mythfrontend: cannot connect to X server :0
>
> I never configure the X server. How could I configure?

That means that either you're running the script as a different user
from the one that's owns the X server or your script is lacking the HOME
environment variable.

Mike
_______________________________________________
mythtv-users mailing list
mythtv-users [at] mythtv
http://www.mythtv.org/mailman/listinfo/mythtv-users


josu.lazkano at gmail

May 5, 2012, 1:41 PM

Post #5 of 6 (655 views)
Permalink
Re: Start frontend from irexec [In reply to]

2012/5/5 Michael T. Dean <mtdean [at] thirdcontact>:
> On 05/05/2012 04:21 PM, Josu Lazkano wrote:
>>
>> 2012/5/5 Raymond Wagner:
>>
>>> On 5/5/2012 15:54, Josu Lazkano wrote:
>>>>
>>>>         #DISPLAY=:0 mythfrontend 2>&1&
>>>>         mythfrontend
>>>>
>>>>
>>>>
>>>> It stop the frontend well, but it doesn't start. It works well if I
>>>> execute from a terminal. But i want to execute without a terminal.
>>>
>>>
>>> Chances are you're trying to run the frontend without an X server to use.
>>>  If you configured it to log somewhere, it would tell you what the
>>> problem
>>> was.
>>
>> Thanks Raymond, I try with this:
>>
>> DISPLAY=:0 xset -dpms
>> DISPLAY=:0 mythfrontend>  /home/lazkano/mythfrontend.log 2>&1&
>>
>> And this is the log file:
>>
>> $ cat mythfrontend.log
>> No protocol specified
>> mythfrontend: cannot connect to X server :0
>>
>> I never configure the X server. How could I configure?
>
>
> That means that either you're running  the script as a different user from
> the one that's owns the X server or your script is lacking the HOME
> environment variable.
>
> Mike
>

Thanks Mike, I start the gnome session with same user as start the
irexec. I try this:

$ echo $DISPLAY


And I don't have nothing, is something wrong?

I need to read more about the X server.

Thanks all!

--
Josu Lazkano
_______________________________________________
mythtv-users mailing list
mythtv-users [at] mythtv
http://www.mythtv.org/mailman/listinfo/mythtv-users


jmorris at beau

May 5, 2012, 7:30 PM

Post #6 of 6 (640 views)
Permalink
Re: Start frontend from irexec [In reply to]

On Sat, 2012-05-05 at 21:54 +0200, Josu Lazkano wrote:
> Hello all, I am trying to configure my remote to start the frontend.
>
> I am using gnome on my system, I read this wiki page:
> http://www.mythtv.org/wiki/Frontend_Loading_Script
>
> I try lots of configuration but I can not start from the desktop, this
> is my script:
>
> #!/bin/sh
>
> if [ ! "$(pidof mythfrontend)" ]
> then
> echo "Mythfrontend is not started. Starting Mythfrontend..."
> #DISPLAY=:0 xset -dpms
> #DISPLAY=:0 mythfrontend 2>&1 &
> mythfrontend
> else
> echo "Mythfrontend is already started. Stoping Mythfrontend..."
> killall mythfrontend
> fi
>
> exit 0

I have dealt with this sort of thing. I would guess you are starting
irexec as a daemon and it isn't working. If you launched the daemon from
a terminal window it would probably work until you logged out; unless it
is purging your environment 'for your protection' of course.

The nub of the problem is you need both the DISPLAY environment variable
to correctly name the display to connect to, which for 99% of people
will be :0.0 but you also need the XAUTHORITY variable. In the olden
days it just pointed to ~/.Xauthority and would be trivial to recreate.
Alas, it has been made 'perfectly safe'... again for your protection.

Below is a fragment of bash code to deal with this issue that I have in
production on CENTOS 6. The idea is to latch onto the session manager
process at the top of the tree and grope around in it's environment
looking for the authority file. Obviously this is only going to work
reliably if the script that launches irexec is running with root privs.
That means you probably want to make sure it then takes care to run
mythfrontend as the right user. If you are implementing this as a more
general solution you can just go back into the session manager's
environment and look for the USER variable.

I am running Fedora on the laptop I'm typing this on but XFCE instead of
GNOME3 so I can't tweak it for the post GNOME2 world.

SESSMANPID=`ps aux | grep gnome-session | grep -v root | awk '{print
$2}'`

if [ "$SESSMANPID" = "" ] ; then
SESSMANPID=`ps aux | grep "sh /usr/bin/startkde" | \
grep -v root | awk '{ print $2}'`
fi

if [ "$SESSMANPID" = "" ] ; then
echo "No session identified."
exit 1
fi

TEMPFILE=`mktemp -t notify.XXXXXX`
cat /proc/$SESSMANPID/environ | tr '\000' '\n' | grep XAUTHORITY \
| cut -f2 -d '=' >$TEMPFILE
XAUTHORITY=`cat $TEMPFILE`
rm $TEMPFILE

if [ "$XAUTHORITY" = "" ] ; then
echo "Couldn't find XAUTHORITY, fatal."
exit 1
fi

DISPLAY=:0.0
Attachments: signature.asc (0.19 KB)

MythTV users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.