Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using cron for network time synchronization AIX 5.1 ML3

Status
Not open for further replies.

hklonline

IS-IT--Management
Apr 17, 2003
2
US
Hi,
I am supposed to implement this request but have no idea what the project leader is talking about (I am new to AIX):
-------------------------------------------------
We need to sync the time for the AIX box with an atomic server. Add an entry to the cron job for each aix box that is the following:

0 * * * * /usr/sbin/ntpdate 192.5.41.209 >/dev/null 2>&1
-------------------------------------------------

Obviously, he gave me the line to put in the "cron job". But, what is a cron job? What file do I edit? Do I need to reboot? How can I test the cron to know it's working? I am on AIX 5.1 ML3.
Thanks,
Heidi
 
hklonline, cron is the Unix scheduler. You use it to have jobs run automatically at the time you set it to run.

At the bottom of this, I have copied a little "cheat sheet" I put at the top of my crontab so I can remember what all the fields are about.

to add the project leader's line to root's crontab, log in as root, and type crontab -e. Then add the line to the crontab using vi commands. Save the file. Do not edit the crontab directly with , as the cron facility won't know the change has been made unless you stop and restart cron.

Try doing a man on cron to read more about it. There are some shortcuts on the time, for example, that should be explained in there. You also can do a man on ntp and xntp to learn more about time syncing.

Regarding time syncing: Check this thread: Thread52-133742. It has pretty detailed info on setting up xntp, which some prefer over ntp. (There have been a lot of people who have posted problems with ntp on this forum.)

And here is my crontab cheat sheet. Good luck!

# Crontab format:
#
# minute (0-59)
# | hour (0-23)
# | | day of the month (1-31)
# | | | month of the year (1-12)
# | | | | day of the week (0-6 with 0=Sunday)
# | | | | | commands
 
Oh, and by the way, you don't need to reboot the system when you make a change to the crontab. And just fyi, crontabs are in /var/spool/cron/crontabs/<username>. But remember, don't edit it directly! Use crontab -e

One way to test if it is working is to not put the string: &quot;>/dev/null 2>&1&quot; in at first. After you reach the top of the hour (because the job is scheduled to run at the top of the hour), as root, type mail. You will get a mail message that the cron job ran and either worked or didn't. After you are convinced that it works, be xure to put the >/dev/null 2>&1 back in the crontab, or you will get 24 emails a day! That string sends standard output and standard error to the device /dev/null.
 
And one final thing: The IP address he gave you is to the Naval Observatory. When I implemented xntp a few years ago, I vaguely remember reading something that the Navy didn't want everyone to be syncing to them, but that systems they had given permission to sync to them could be used. So, you might want to make sure you can use the IP address the project lead gave you. Others might know better about this, though.
 
Thanks bi for your help ! It is great. I will check on the the server you mention and see if we can use it or need something else.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top