Author |
Message |
Warped
|
Posted: Tue Aug 22, 2006 6:54 am |
|
Joined: Thu Jun 23, 2005 1:20 am
Posts: 148
|
Hi All,
I'm living in country without XMLTV listings provider - so I have to generate them myself.
For this purpose I'm using TVxb and Wine.
TVxb is launched via following script:
----------------------------------------
#!/bin/bash
cd /home/mythtv/grabber/TVxb/bin
cp -f /home/mythtv/.Xauthority /root/
mv -f ./aster.xml ./aster.xml.old
export DISPLAY=:0.0
wine TVxb.exe -NoConsole > /var/log/grabber/tvxb-wine-output.log 2>&1
sleep 2
test -e ./aster.xml || exit 0
mythfilldatabase --file 1 -1 aster.xml > /var/log/grabber/filldatabase-output.log 2>&1
-----------------------------------------
Using this script in Terminal window works without any problem.
But when I configure Myth to launch it periodically (mythfilldatabse in TV/general setup) or via cron - following errors are reported:
-----------------------------------------
Warning:
The Wine launcher is unable to find the xmessage program,
which it needs to properly notify you of Wine execution status
or problems.
This launcher script relies heavily on finding this tool,
and without it, it will behave very poorly.
We strongly recommend that you use your distribution's
software methods to locate xmessage, or alternatively
use your favourite internet search engine to find out
how you are supposed to install xmessage on your system.
Xlib: connection to ":0.0" refused by server
Xlib: Invalid MIT-MAGIC-COOKIE-1 key
[1;24r[0;10m[4l[H[JXlib: connection to ":0.0" refused by server
Xlib: Invalid MIT-MAGIC-COOKIE-1 key
fixme:ttydrv:TTYDRV_GetBitmapBits (0x7c, 0x7fd5425c, 128): stub
fixme:ttydrv:TTYDRV_GetBitmapBits (0x140, 0x7fd581ec, 128): stub
fixme:msvcrt:_XcptFilter (-1073741819,0x7fbeeea4)semi-stub
wine: Unhandled exception (thread 0009), starting debugger...
err:seh:start_debugger Couldn't start debugger ("winedbg 8 84") (2)
Read the Wine Developers Guide on how to set up winedbg or another debugger
[24;1H
Wine failed with return code 5
-------------------------------------------
It looks like enviroment problem manifesting when script is launched via myth or cron.
May somebode hint me where problem might be ?
Million thanx in advance !
|
|
Top |
|
 |
nickread
|
Posted: Tue Aug 22, 2006 6:36 pm |
|
Joined: Tue Nov 22, 2005 7:57 pm
Posts: 295
Location:
Auckland, New Zealand
|
Warped wrote: It looks like enviroment problem manifesting when script is launched via myth or cron.
Exactly. You need to set all and any environment variables required when using cron. See this post for ideas:
http://mysettopbox.tv/phpBB2/viewtopic.php?t=10953&highlight=cron+profile
_________________ HP VL400 (PIII 866), Skystar2 2.6D, PVR350, Nvidia FX5200, 384MB, 200GB, KnoppMyth R5.5
|
|
Top |
|
 |
Warped
|
Posted: Wed Aug 23, 2006 1:12 pm |
|
Joined: Thu Jun 23, 2005 1:20 am
Posts: 148
|
Nickread,
I really appreciate Your help, but I need little more details.
In dir ~/myth there is no ./profile file.
I assume I have to use /etc/profile file
I tried following statement in crontab
5 20 * * * mythtv . /etc/profile; /home/myth/grabber/tvgrabber.sh
In logs I see:
Xlib: connection to ":0.0" refused by server
Xlib: Invalid MIT-MAGIC-COOKIE-1 key
Error opening terminal: unknown.
Wine failed with return code 1
tvgrabber.sh:
#!/bin/bash
cd /home/mythtv/grabber/TVxb/bin
# cp -f /home/mythtv/.Xauthority /root/
mv -f ./aster.xml ./aster.xml.old
export DISPLAY=:0.0
wine TVxb.exe -NoConsole > /var/log/grabber/tvxb-wine-output.log 2>&1
sleep 2
test -e ./aster.xml || exit 0
mythfilldatabase --file 1 -1 aster.xml > /var/log/grabber/filldatabase-output.log 2>&1
million thanx in advance
nickread wrote: Warped wrote: It looks like enviroment problem manifesting when script is launched via myth or cron. Exactly. You need to set all and any environment variables required when using cron. See this post for ideas: http://mysettopbox.tv/phpBB2/viewtopic.php?t=10953&highlight=cron+profile
|
|
Top |
|
 |
nickread
|
Posted: Wed Aug 23, 2006 4:32 pm |
|
Joined: Tue Nov 22, 2005 7:57 pm
Posts: 295
Location:
Auckland, New Zealand
|
http://linux.math.tifr.res.in/manuals/man/cron.html
~ is a shortcut to the home directory of the current user (in this case the owner of the crontab file), should be root
.profile is a hidden file (begins with .) so won't show up unless you use 'ls -a'. So you should have a .profile in /root, which is assuming that when it works from the command line you are doing it as root.
There may be other environment vars used for Wine, I don't know anything about it, but I guess they would be . files in the home directory as well.
_________________ HP VL400 (PIII 866), Skystar2 2.6D, PVR350, Nvidia FX5200, 384MB, 200GB, KnoppMyth R5.5
|
|
Top |
|
 |
nickread
|
Posted: Thu Aug 24, 2006 5:33 am |
|
Joined: Tue Nov 22, 2005 7:57 pm
Posts: 295
Location:
Auckland, New Zealand
|
Ok, I'm home now - so I can check whats on my box. You're right, theres no .profile in /root or /home/mythtv, although there is a .bash_profile in /home/mythtv
You won't be able to execute /etc/profile unless you modify the permissions.
The simplest thing to try is to just add a path statement to your crontab file with whatever the path is when its working from the command line (echo $PATH).
_________________ HP VL400 (PIII 866), Skystar2 2.6D, PVR350, Nvidia FX5200, 384MB, 200GB, KnoppMyth R5.5
|
|
Top |
|
 |
Warped
|
Posted: Thu Aug 24, 2006 2:33 pm |
|
Joined: Thu Jun 23, 2005 1:20 am
Posts: 148
|
Nickread,
Thx for trying help.
In fact I'm little confused
Indeed in ~/mythtv there is bash_profile but all content is commented...
In crontqb I have already setup path to:
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
So my question is:
where is file which I should use for setting cron launched environment to the same state like alt-x launched terminal (in which my tvgrabber.sh scrip working well)
pls remember - in KM cron launching session with given user (mythtv here)
br
nickread wrote: Ok, I'm home now - so I can check whats on my box. You're right, theres no .profile in /root or /home/mythtv, although there is a .bash_profile in /home/mythtv
You won't be able to execute /etc/profile unless you modify the permissions.
The simplest thing to try is to just add a path statement to your crontab file with whatever the path is when its working from the command line (echo $PATH).
|
|
Top |
|
 |
nickread
|
Posted: Thu Aug 24, 2006 4:31 pm |
|
Joined: Tue Nov 22, 2005 7:57 pm
Posts: 295
Location:
Auckland, New Zealand
|
Just to clarify:
1) What user are you running the script as from the command line? Root or mythtv?
2) Is the path in the crontab the same as the path in the terminal for that user?
Also, the X messages indicate that possibly the cron user does not have permission to access the X display. Maybe it is not running as user mythtv?
I beleive that if you issue the command 'xhost +' from the command line it will allow everyone (inc root) to access the display. Try that before the cron job runs and see. You can turn it off afterwards with 'xhost -'
_________________ HP VL400 (PIII 866), Skystar2 2.6D, PVR350, Nvidia FX5200, 384MB, 200GB, KnoppMyth R5.5
|
|
Top |
|
 |
khrusher
|
Posted: Thu Aug 24, 2006 6:04 pm |
|
Joined: Tue Apr 13, 2004 6:51 pm
Posts: 890
Location:
Groton, MA
|
ok, there is SOMETHING in your login shell that is not availible in your cron environmetn...that is a common problem.
your cron job can source any file...not just a .profile or .bash. i have often created ~/.cron files to set anything needed for cron.
you can start with PATH...
Code: env | grep PATH > ~mythtv/.cron echo "export PATH" >> ~mythtv/.cron then change your crontab to include Code: . ~mythtv/.cron
If it still has issues, continue to add env vars to the .cron file until all is well. use the command 'env' to view all environment vars in your current shell.
as for your crontab format, I see you have the 'username format' isnt that reserved for /etc/crontab? is that where you have it? If not, if you are using corntab <filename> to load the cron while logged in as mythtv, you may want to lose the username column from the crtontab file
_________________ R5F1 - Dell P4 2.4Ghz 500MB - PVR250 x 2 - GeForce FX 5200 - Onboard sound/NIC 80GB ATA/250GB ATA/400GB SATA
|
|
Top |
|
 |
Warped
|
Posted: Tue Aug 29, 2006 2:07 am |
|
Joined: Thu Jun 23, 2005 1:20 am
Posts: 148
|
khrusher,
Big thanx for nice help. I nailed down issue:
I have to add to my script following statements:
export SHELL=/bin/sh
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
export DISPLAY=:0.0
export XAUTHORITY=/tmp/.gdmn5MBcA
Now problem is that XAUTHORITY variable is changing every boot.
Probably there is simple way to overcome this issue, but I haven't time to drill across tons of Linux mans and docs.
Maybe You can hint me....
Thx
khrusher wrote: ok, there is SOMETHING in your login shell that is not availible in your cron environmetn...that is a common problem. at your cron job can source any file...not just a .profile or .bash. i have often created ~/.cron files to set anything needed for cron. you can start with PATH... Code: env | grep PATH > ~mythtv/.cron echo "export PATH" >> ~mythtv/.cron then change your crontab to include Code: . ~mythtv/.cron If it still has issues, continue to add env vars to the .cron file until all is well. use the command 'env' to view all environment vars in your current shell.
|
|
Top |
|
 |
khrusher
|
Posted: Tue Aug 29, 2006 6:48 am |
|
Joined: Tue Apr 13, 2004 6:51 pm
Posts: 890
Location:
Groton, MA
|
are many folks running xauth on their myth boxes? not here.
While its nice, probably over kill unless you have multiple users on the box at a time...and you dont want or expect the other user to be 'snooping' on your X session.
_________________ R5F1 - Dell P4 2.4Ghz 500MB - PVR250 x 2 - GeForce FX 5200 - Onboard sound/NIC 80GB ATA/250GB ATA/400GB SATA
|
|
Top |
|
 |
Warped
|
Posted: Tue Aug 29, 2006 7:07 am |
|
Joined: Thu Jun 23, 2005 1:20 am
Posts: 148
|
Oh well,
So xauth is optional !
How can I switch it off ?
BTW: I see You are using Nv5200. Are You running r5c7 ?
If so - has r5c7 build-in drivers for 5200 or should I install nv drivers separately ?
In my r5c7 I install nv5200 and fresh r5c7 - but I receive some nv related errors during boot. Is it normal or my nv5200 is broken or maybe drivers are missing....
khrusher wrote: are many folks running xauth on their myth boxes? not here.
While its nice, probably over kill unless you have multiple users on the box at a time...and you dont want or expect the other user to be 'snooping' on your X session.
|
|
Top |
|
 |
khrusher
|
Posted: Tue Aug 29, 2006 1:48 pm |
|
Joined: Tue Apr 13, 2004 6:51 pm
Posts: 890
Location:
Groton, MA
|
sorry, im am running the very old R5A16 dated May 2005.
As far as xauth, I dont know much about it...I googled it this morning when i read your post. its basically a more secure xhost.
I'm not saying you need to turn it off, I was just posing the question. Looks to me is that your issue is that xauth limits access to the xserver to a particular session....a session different then you cron session.
_________________ R5F1 - Dell P4 2.4Ghz 500MB - PVR250 x 2 - GeForce FX 5200 - Onboard sound/NIC 80GB ATA/250GB ATA/400GB SATA
|
|
Top |
|
 |