View unanswered posts    View active topics

All times are UTC - 6 hours





Post new topic Reply to topic  [ 2 posts ] 
Print view Previous topic   Next topic  
Author Message
Search for:
PostPosted: Thu Sep 09, 2004 6:19 am 
Offline
Joined: Wed Jan 07, 2004 12:14 pm
Posts: 434
Location: Charlotte, NC
I am running a fresh install of 15.1 and am having a problem with mythfilldatabase running as either a cron job (cron.daily) or built-in. When run from a command line (either as root or mythtv) it works fine.

As an experiment I have set both a cron job and the built-in job... Cron.daily entry:

#!/bin/sh

su mythtv -c "mythfilldatabase --quiet"

I have searched the logs and can find only one clue. I have set the cron job to run at 5:25 and get the following in /var/log/auth.log

Sep 9 05:25:01 mythtv cron(pam_unix)[3741]: session opened for user root by (uid=0)
Sep 9 05:25:01 mythtv su[3764]: + ??? root-nobody
Sep 9 05:25:01 mythtv su(pam_unix)[3764]: session opened for user nobody by (uid=0)
Sep 9 05:30:01 mythtv cron(pam_unix)[4095]: session opened for user root by (uid=0)

That is the only reference in any of my logs to anything at 5:25.

I have the "built-in mythfilldatabase" scheduled to run between 7AM and 8AM. I can find no evidence that anything ran (no logs, no update to the schedule, and no status message).

I have run out of ideas...

Everything else runs perfectly.

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 09, 2004 9:36 pm 
Offline
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location: Arlington, MA
"Three things ye must know about the wisewoman..." Oh wait, wrong topic. ;-) Two things ye must know about the cron job...

- One of the best ways to debug a cron job is to put in lines like this:
Code:
echo "At start of myscript" >>/tmp/myscript.debug.$$.log

Put somthing like this near the beginning, another at the end, ... You get the picture. Don't forget to remove or comment them out when you're done debugging. Even more informative:
Code:
/usr/bin/env >>/tmp/myscript.debug.$$.log


- cron jobs run in stripped envionment, among other things that means that you don't have a full path, and shouldn't assume any. As a result you should always test a script intended for a cron job like this:
Code:
env -i myscript.sh

This will let you spot any unwarranted assumptions about your environment.

So given this, the bug in your script should be obvious, replacing:
Code:
su mythtv -c "mythfilldatabase --quiet"

with this:
Code:
/bin/su mythtv -c "/usr/bin/mythfilldatabase --quiet"

should solve your problem.


Top
 Profile  
 

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 


All times are UTC - 6 hours




Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group

Theme Created By ceyhansuyu