This is Bavaria, Germany!
Table of contents:
I wanted simply a Linux-Timeserver in my LAN. But the LAN has only a dial-up connection to the internet which costs a lot of money. My WindowsNT-hosts also shall have syncronized time. I took this approach:
#!/bin/sh
# file: ~root/bin/timesync
#
echo "Syncronizing time with NTP-hosts"
# -l: max sync time is 180 sec
# -v: show groups
# netdate need port 37/udp, firewalling
# get servers from:
# http://www.eecis.udel.edu/~mills/ntp/clock1.htm
/usr/sbin/netdate -l 3600 tcp \
ts2.univie.ac.at \
ts1.univie.ac.at \
ntp.lth.se
hwclock -w
# ntpdate ntp1.ptb.de
9 Jan 21:35:52 ntpdate[31311]: step time server 192.53.103.103 offset -3601.519274 sec!/
This is the configfile:
root@gatekeeper:/etc > cat /etc/ntp.confserver ntp2.ptb.de
# /etc/ntp.conf
# do not get time from other ntp-Servers:
# disable ntp
driftfile /etc/ntp.drift
# get time from these servers
server ntp1.belbone.be
server clock.fmt.he.net
server ntp.globe.cz
server ntp.tuxfamily.net
You do not need to create the file /etc/ntp.drift
Start ntpd with /usr/local/bin/ntpd
Port 123/UDP must be free to the local net so that Windows-machines
can get time from Linux
There is one which is the best: ntptime.exe at http://home.att.net/~Tom.Horsley
Simply believe me. It runs as service and creates a good logfile.
Only installation has to be made with regedit, but this is nothing
you should take care about.
If WindowsNT-Server is syncronized your NT-Workstations can get their time with "net time \\server /set /yes" in a loginscript.
Life is so simple sometimes. You want to have the right time on your machine. Simply syncronize it with other computers in the net. You need "netdate" for this on your Linuxmachine (find the rpm in http://www.rpmfind.net and look for netdate).
Write this scripts /root/bin/timesync:
#!/bin/sh # file: ~root/bin/timesync # echo "Syncronizing time with NTP-hosts" # -l: max sync time is 180 sec # -v: show groups # netdate needs port 37/udp, firewalling netdate -l 180 \ ntp0.fau.de \ time.ien.it # set the hardware clock to this time hwclock -w
Let the script run two times a day by cron:
# crontab -e 00 3,21 * * * (/root/bin/timesync.sh) >/dev/null 2>&1
If you want to mirror a larger FTP-site or want it to mirror on a regular basis do it with a good package like "mirror" (look for a ready .rpm to install it). I don't like to do that with ncftp which is perfect for command-line things because I have some trouble with it when it's getting _reeeeaal_ big (how to handle zero-bytefiles, Defaults when answering questions). Ok, I suggest: ncftp for manual things, mirror for automatic things.
First create a packagefile in your homedirectory: ~/.mirror.txt. Here is mine (officical documentation is here):
# Packagefile for mirror: ~/.mirror.txt
package=defaults
comment=Carpictures
# ls -lR does not work on this server
recurse_hard=true
# dont's get files only because they have another timestamp
get_newer=false
# but get them always when their filesize is different
get_size_change=true
# never delete local files
do_deletes=false
# try to create a local timestamp like the remote one
force_times=yes
mail_to=me@localhost
package=ford_pictures
site=remote.juhei.de
remote_user=lippmann
remote_password=secret
remote_dir=/cars/pics/ford/
local_dir=/home/horshack/pics/cars/ford
mail_subject=Mirror ford_pictures
package=bmw_pictures
site=bmw.juhei.org
remote_user=bmwfreex
remote_password=secret2
remote_dir=/pub/carpics/bmw/
local_dir=/home/horshack/pics/cars/bmw
mail_subject=Mirror bmw_pictures
Call mirror like this:
# -d means: be verbose
# -p means: take care only about the package
bmw_pictures
# last argument is the file with all the values
mirror
-d -p bmw_pictures ~/mirror.txt
# -n means: don't transfer anything
# -d -d means: be very verbose
#
-p means: take care only about the package bmw_pictures
# last argument
is the file with all the values
mirror -n -d -d -p bmw_pictures
~/mirror.txt
|
Last modified: 09.01.2005 21:40 Impressum |
Wozu Witze ausdenken?
Das Leben schreibt sie selbst: Das haben wir jetzt 40 Jahre so gemacht, warum sollten wir das ändern? |
Why inventing jokes?
Real life does a better job: We are doing it this way for 40 years, why should we change it? |