LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-27-2007, 04:52 AM   #1
xpucto
Member
 
Registered: Sep 2005
Location: Vienna, Austria
Distribution: Mint 13
Posts: 524

Rep: Reputation: 31
ntpdate doesn´t work by booting


Hi!

I wrote a 1 line script to use ntpdate. wenn I start the script manually it works. I put it in /etc/init.d and made symbolic links in /etc/rc3.d/and /etc/rc5.d/. But it doesn´t work when I boot. I still have to run the script manually. Can´ t work ntpdate during booting?
 
Old 04-27-2007, 05:07 AM   #2
Gethyn
Member
 
Registered: Aug 2003
Location: UK
Distribution: (X)Ubuntu 10.04/10.10, Debian 5, CentOS 5
Posts: 900

Rep: Reputation: 32
It won't work unless the network is already up.
 
Old 04-27-2007, 12:22 PM   #3
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
Here's my solution:
I don't want the time checking more often than once a day (I do not want to annoy those timeservers!)

I put this line in root's crontab
Code:
5 * * * * /usr/sbin/chktime
So the script chktime is called at five minutes past every hour.

This is the script, it is very simple:
Code:
#!/bin/bash
# chktime 
# No need to check the time more than once a day, no matter how often
# this script is called
# Note the date format: we do NOT want spaces in the date!
NOW=`date +%a%b%d`
LAST=`cat /etc/.lasttimecheck`
if [ "$NOW" != "$LAST" ]; then
	echo -n $NOW > /etc/.lasttimecheck
	/usr/sbin/ntpdate uk.pool.ntp.org ; echo "ntpdate set the date" >> /var/log/messages
fi
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
vnc4server doesn`t work! tyranus Debian 4 06-02-2006 06:08 PM
Wi-Fi doesn;t work on Suse 9.3 hackerarchangel Linux - Hardware 2 10-18-2005 12:59 PM
Microphone doesn' work Lars79 Slackware 20 08-30-2005 09:24 AM
NTPDATE will *NOT* work jon_k Linux - Software 8 01-02-2005 05:41 AM
kopete doesn´t work maZ Linux - Software 1 07-31-2003 03:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:15 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