View unanswered posts    View active topics

All times are UTC - 6 hours





Post new topic Reply to topic  [ 15 posts ] 
Print view Previous topic   Next topic  
Author Message
Search for:
 Post subject: Cron and clock setting
PostPosted: Tue Jul 25, 2006 8:58 pm 
Offline
Joined: Thu Jul 06, 2006 1:10 pm
Posts: 40
I'm using the latest Knoppmyth (C7) and am trying to use an hourly cron job with ntpdate to keep the clock set.

0 * * * * ntpdate us.pool.ntp.org

I have no ntpd processes running, and when I manually enter in the command as listed above, it sets the clock fine.

It just simply appears that cron is not firing off the command. I did double check through ps -A that 'cron' is listed.

Any idea why cron is not firing? :(

Thanks.
Matt


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 25, 2006 11:02 pm 
Offline
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location: Arlington, MA
A normal R5C7 install already sets up a running ntpd for you... As root run:
Code:
root@black2:~# pgrep -fl ntp
4918 /usr/sbin/ntpd -p /var/run/ntpd.pid

to see if it's running... The results should look like the example shown above.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 26, 2006 4:58 am 
Offline
Joined: Thu Jul 06, 2006 1:10 pm
Posts: 40
When I enter...

'pgrep -fl ntp'

...I get nothing back. I looked at what's in /etc/init.d and I don't see 'ntpd'. I do see 'ntp-server' - is that what should be started?

Thanks for the reply...
Matt


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 26, 2006 7:02 am 
Offline
Joined: Sun Jun 12, 2005 2:39 pm
Posts: 464
Location: UK
Don't you need to use the full path to executables in crontab?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 26, 2006 9:03 am 
Offline
Joined: Thu Jul 06, 2006 1:10 pm
Posts: 40
mad_paddler wrote:
Don't you need to use the full path to executables in crontab?

Thanks - I'll try that and see how it goes :)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 26, 2006 9:26 am 
Offline
Joined: Fri Apr 02, 2004 10:08 am
Posts: 1637
Location: Virginia, USA
Just to make an additional point, if ntpd is running on your system (and as tjc said, it should be part of a current KnoppMyth install), running ntpdate will not work. Actually, that's a good point... can you run that command from a terminal? That's another indicator if ntpd is running (or if your cron job will work).


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 26, 2006 9:35 am 
Offline
Joined: Thu Jul 06, 2006 1:10 pm
Posts: 40
ceenvee703 wrote:
Just to make an additional point, if ntpd is running on your system (and as tjc said, it should be part of a current KnoppMyth install), running ntpdate will not work. Actually, that's a good point... can you run that command from a terminal? That's another indicator if ntpd is running (or if your cron job will work).
ntpd is not running, and, yes, running ntpdate from the command line works fine.

Thanks.
Matt


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 26, 2006 11:38 am 
Offline
Joined: Thu Jul 06, 2006 1:10 pm
Posts: 40
w00t! It looks like providing the full path to ntpdate was the answer!

Much obliged... :D
Matt


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 26, 2006 8:46 pm 
Offline
Joined: Sun Jun 12, 2005 10:55 pm
Posts: 3161
Location: Warwick, RI
Hi

Just a bit curious, but why disable ntpd for a manual cron task of setting the time? The ntpd also has a drift file that it fine tunes as it runs so your box should stay quite on time.

If you have a particular server, that can be set in /etc/ntp.conf in line
server north-america.pool.ntp.org

I do kick mine on a boot up just for grins & giggles by adding to /etc/init.d/bootmisc.sh
ntpdate north-america.pool.ntp.org as the last entry.

cesman went to a lot of skilled effort to have that set for us. Shame not to take advantage.

Mike


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 26, 2006 9:05 pm 
Offline
Joined: Thu Jul 06, 2006 1:10 pm
Posts: 40
I would like to have used the built-in ntpd, but I noticed it didn't seem to keep up with my wonderfully flawed nforce2 board.

I needed to set the clock every hour or it would drift too far off, and I would miss the last bit of a show - not great for the ole' WAF :) .

-Matt


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 27, 2006 7:13 am 
Offline
Joined: Sun Jun 12, 2005 2:39 pm
Posts: 464
Location: UK
Just in case anyone didnt know, even if ntpd is running you can still use ntpdate by using the -u switch, e.g.

ntpdate -u pool.ntp.org


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 27, 2006 7:27 am 
Offline
Joined: Tue Apr 13, 2004 6:51 pm
Posts: 890
Location: Groton, MA
as a practice, I capture cron output into a file until I'm sure it's running properly...
Code:
0 * * * * ntpdate us.pool.ntp.org > /tmp/cron.log 2>&1

Once running, the output redirection can be removed.

In your case, you most likely would have seen something like:
Code:
ntpdate: Command not found

Keep in mind that the cron process for a user does not 'login', that is to say, it does not source .profile, .kshrc, etc.

None of the environment vars that are set at login are set in the cron env...PATH in your example.

If you need many vars set for cron jobs, you can manually source the files. For example
Code:
0 * * * * . ~/.profile; ntpdate us.pool.ntp.org

that is
Code:
0 * * * * <dot><space>~/.profile; ntpdate us.pool.ntp.org

_________________
R5F1 - Dell P4 2.4Ghz 500MB - PVR250 x 2 - GeForce FX 5200 - Onboard sound/NIC 80GB ATA/250GB ATA/400GB SATA


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 28, 2006 9:49 pm 
Offline
Joined: Tue Oct 28, 2003 10:32 pm
Posts: 9
I am running an nforce2 board as well and am 30 minutes off in less than 12 hours. Is there a way I can finetune the cesman's work so it updates more frequently or should I shut it down and go the cron method as quaffapaint has?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 29, 2006 5:35 am 
Offline
Joined: Fri Apr 02, 2004 10:08 am
Posts: 1637
Location: Virginia, USA
The clock problem with nforce2 boards can be solved... search for "nforce clock" or various terms. Here's one thread:

http://mysettopbox.tv/phpBB2/viewtopic. ... lilo+clock

Every now and then my nforce2 mobo will flip out and start running fast and ntpd can't seem to adjust for it. I'll then try the lilo adjustments mentioned in the various threads on the board (including the one above). For me, the adjustment kills a tuner card. I then take it back out of lilo, reboot, and things are fine. Go figure.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 29, 2006 9:18 am 
Offline
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location: Arlington, MA
I've added a new troubleshooting page on the wiki for this issue. Could someone who can't use "noapic noioapic" and who has successfully used a periodic cron job to fix this issue add that? Thanks.
http://www.knoppmythwiki.org/index.php?page=Nforce2TimeDrift


Top
 Profile  
 

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


All times are UTC - 6 hours




Who is online

Users browsing this forum: No registered users and 21 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:  
Powered by phpBB® Forum Software © phpBB Group

Theme Created By ceyhansuyu