LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-17-2005, 07:00 AM   #1
Garp
Member
 
Registered: Jul 2003
Location: Oahu, Hawaii, USA
Distribution: Ubuntu, Debian, RHES
Posts: 57

Rep: Reputation: 15
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?
 
Old 11-17-2005, 07:22 AM   #2
kilgoretrout
Senior Member
 
Registered: Oct 2003
Posts: 2,988

Rep: Reputation: 388Reputation: 388Reputation: 388Reputation: 388
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:
NAME


crontab - maintain crontab files for individual users (V3)

SYNOPSIS


crontab [ -u user ] file
crontab [ -u user ] { -l | -r | -e }

DESCRIPTION


Crontab is the program used to install, deinstall or list the tables used to drive the cron(8) daemon in Vixie Cron. Each user can have their own crontab, and though these are files in /var, they are not intended to be edited directly.
So it should be possible to setup a crontab and cron job to be run from the user that works with your script.
 
Old 11-17-2005, 07:55 AM   #3
Garp
Member
 
Registered: Jul 2003
Location: Oahu, Hawaii, USA
Distribution: Ubuntu, Debian, RHES
Posts: 57

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by kilgoretrout
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:



So it should be possible to setup a crontab and cron job to be run from the user that works with your script.
I'm getting at cron by running "crontab -u root -e"

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.
 
Old 11-17-2005, 09:59 AM   #4
kilgoretrout
Senior Member
 
Registered: Oct 2003
Posts: 2,988

Rep: Reputation: 388Reputation: 388Reputation: 388Reputation: 388
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.

Last edited by kilgoretrout; 11-17-2005 at 12:38 PM.
 
Old 11-18-2005, 04:58 AM   #5
Garp
Member
 
Registered: Jul 2003
Location: Oahu, Hawaii, USA
Distribution: Ubuntu, Debian, RHES
Posts: 57

Original Poster
Rep: Reputation: 15
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:
All data is the copyright of the Radio Times website
<http://www.radiotimes.com> and the use of this data is restricted to
personal use only.

RT id 1872 (Challenge +1) not known in channel ids file
RT id 1873 (Living TV 2) not known in channel ids file
RT id 1874 (UKTV People +1) not known in channel ids file
RT id 1876 (British Eurosport 2) not known in channel ids file
RT id 1877 (B TV) not known in channel ids file
RT id 1882 (UKTV Style Gardens) not known in channel ids file
RT id 1885 (Xtraview) not known in channel ids file
RT id 1942 (B4U Music) not known in channel ids file
RT id 1943 (Boro TV) not known in channel ids file
RT id 1944 (Channel M) not known in channel ids file
RT id 1953 (Discovery Home & Health +1) not known in channel ids file
RT id 1948 (Phoenix CNE) not known in channel ids file
RT id 1949 (Racing UK) not known in channel ids file
RT id 1950 (Stop & Shop) not known in channel ids file
RT id 1951 (TV Warehouse) not known in channel ids file
RT id 1952 (Thane Direct) not known in channel ids file
RT id 1955 (Teachers' TV (satellite/cable/DSL)) not known in channel ids file
RT id 1956 (Teachers' TV (digital terrestrial)) not known in channel ids file
RT id 1958 (Motors TV) not known in channel ids file
RT id 1959 (More4) not known in channel ids file
RT id 1961 (ITV4) not known in channel ids file
RT id 1963 (Sky Three) not known in channel ids file
channel gmtv2.gmtv.co.uk (1863) not seen on site at /usr/bin/tv_grab_uk_rt line 196.
channel news.eurosport.com (1742) not seen on site at /usr/bin/tv_grab_uk_rt line 196.
channel plus.granadatv.co.uk (177) not seen on site at /usr/bin/tv_grab_uk_rt line 196.
channel ftv.com (583) not seen on site at /usr/bin/tv_grab_uk_rt line 196.
channel traveldealsdirect.com (593) not seen on site at /usr/bin/tv_grab_uk_rt line 196.
channel n2.rte.ie (46) not seen on site at /usr/bin/tv_grab_uk_rt line 196.
channel cable.travelchannel.co.uk (285) not seen on site at /usr/bin/tv_grab_uk_rt line 196.
channel auction-world.tv (1762) not seen on site at /usr/bin/tv_grab_uk_rt line 196.
channel motors.tv (1581) not seen on site at /usr/bin/tv_grab_uk_rt line 196.
channel taste.co.uk (278) not seen on site at /usr/bin/tv_grab_uk_rt line 196.
channel gmtv.co.uk (1801) not seen on site at /usr/bin/tv_grab_uk_rt line 196.
All the standard error messages. Mythfilldatabase --quiet produces no display, yet the log output from it tells me it failed to get content.

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:
2005-11-18 02:14:33.340 New DB connection, total: 1
2005-11-18 02:14:33.361 New DB connection, total: 2
2005-11-18 02:14:33.382 New DB connection, total: 3
All data is the copyright of the Radio Times website
<http://www.radiotimes.com> and the use of this data is restricted to
personal use only.

could not fetch http://xmltv.radiotimes.com/xmltv/channels.dat, aborting
Error in 1:1: unexpected end of file
2005-11-18 02:17:35.678 New DB connection, total: 4
Failed to fetch some program info
2005-11-18 02:17:36.879 mythfilldatabase: Failed to fetch some program info

Last edited by Garp; 11-18-2005 at 05:02 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
cron job wbatzle Linux - Newbie 2 07-12-2005 04:19 PM
cron job? dr_zayus69 Linux - Newbie 14 12-01-2004 06:16 PM
cron job the_rhino Linux - Newbie 10 10-02-2004 03:34 PM
cron job thesnaggle Linux - Newbie 1 09-19-2003 10:47 AM
Cron job T-Rex Linux - Newbie 1 09-26-2001 11:28 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:35 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration