Cron job fun..
I'm getting a little baffled / frustrated at the moment.
I've got a PVR box setup using mythtv on a gentoo install and I'm trying to cron job a "mythfilldatabase --quiet" run, yet every time it fails. Reading the log file I've got it creating suggests that its got no internet access when it runs, yet if I trigger the shell script I've got cron'd manually it quite happily goes away and gets the xmltv feed. So, as best as I can tell the cron job for the root user doesn't have internet access? The box itself has various proxy server details setup on it, and in an attempt to ensure they occured in the cron session I added the necessary "export" commands to the script. if you run mythfilldatabase without the --quiet flag it just fails in early stages because it tries to work out the screen width for generating a progress bar. With it it fails to grab data. I've tried to tackle this from the other angle, calling tv_grab_uk_rt and outputting it to an xml file, but it also fails; and again as with the mythfilldatabase script, it works happily when I call it as root. I'm really baffled, I've not done stuff with any cron daemon (vixie-cron in this case) before myself, and I just can't understand why root's crontab seems to be unable to access the internet. Should it be able to? Do I need to give it more rights somehow? |
Check out crontab(i.e. man crontab). You can setup cron jobs for individual users other than root with crontab IIRC. Quoting from man crontab:
Quote:
|
Quote:
Running the script logged in as root it works fine. Running form root's crontab it seems to fail to access the internet. If I call the command direct from the crontab it makes no difference from calling it through the script. Ultimately when I'm confident its working as root, I'll try it as another user, this is in the interests of getting it working in the first place. Given the level of access a root users has there surely should be no reason why it runs from shell manually without fuss, but fails from cron. |
Sorry, I misunderstood. Is "mythfilldatabase" a script or a command from mythtv? If it's a script, please post it.
Here's one thing I found about cron the hard way. I had made some backup scripts using tar to be run as cron jobs at certain intervals. The scripts all worked perfectly manually but always failed when run by cron. It turns out that I was using "tar -cvzf" to create the various backup archives and by removing the "v"(tar -czf) everything would run fine in cron mode. The verbose flag was the problem in cron. My thought is that if your "mythfilldatabase" normally outputs anything to the console when run manually, you could be running into the same type of problem. I believe that if there is output like from a "v" flag, it might have to have somewhere to go in the cron command. You could try changing the command to: mythfilldatabase --quiet >> /tmp/testlog so any output could go into /tmp/testlog. |
Thanks for your help :)
mythfilldatabase is a command that is part of the mythtv application suite. It in turn calls on the tv_grab_uk_rt program that comes as part of the xmltv suite of apps. Both mythfilldatabase and tv_grab_uk_rt like to push stuff out to the display, but both applications will be fairly quiet if the "--quiet" argument is used. tv_grab_uk_rt shoves this out to the display even if I tell it to run in quiet: Quote:
I've tried running a crontab job to do a wget on a file on my webspace and that has worked, so I think it'll be more appropriate for me to carry on this discussion on a mythtv or xmltv forum. mythfilldatabase --quiet log: Quote:
|
All times are GMT -5. The time now is 02:43 AM. |