LinHES Forums
http://forum.linhes.org/

Cron and clock setting
http://forum.linhes.org/viewtopic.php?f=6&t=10953
Page 1 of 1

Author:  quaffapint [ Tue Jul 25, 2006 8:58 pm ]
Post subject:  Cron and clock setting

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

Author:  tjc [ Tue Jul 25, 2006 11:02 pm ]
Post subject: 

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.

Author:  quaffapint [ Wed Jul 26, 2006 4:58 am ]
Post subject: 

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

Author:  mad_paddler [ Wed Jul 26, 2006 7:02 am ]
Post subject: 

Don't you need to use the full path to executables in crontab?

Author:  quaffapint [ Wed Jul 26, 2006 9:03 am ]
Post subject: 

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 :)

Author:  ceenvee703 [ Wed Jul 26, 2006 9:26 am ]
Post subject: 

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).

Author:  quaffapint [ Wed Jul 26, 2006 9:35 am ]
Post subject: 

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

Author:  quaffapint [ Wed Jul 26, 2006 11:38 am ]
Post subject: 

w00t! It looks like providing the full path to ntpdate was the answer!

Much obliged... :D
Matt

Author:  mjl [ Wed Jul 26, 2006 8:46 pm ]
Post subject: 

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

Author:  quaffapint [ Wed Jul 26, 2006 9:05 pm ]
Post subject: 

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

Author:  mad_paddler [ Thu Jul 27, 2006 7:13 am ]
Post subject: 

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

Author:  khrusher [ Thu Jul 27, 2006 7:27 am ]
Post subject: 

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

Author:  wardjame [ Fri Jul 28, 2006 9:49 pm ]
Post subject: 

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?

Author:  ceenvee703 [ Sat Jul 29, 2006 5:35 am ]
Post subject: 

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.

Author:  tjc [ Sat Jul 29, 2006 9:18 am ]
Post subject: 

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

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/