[TAG] 2-cent tip: non-NTP system time setting

Thomas Adam thomas_adam at bonbon.net
Sat Jul 24 00:42:29 MSD 2004


On Fri, 23 Jul 2004 14:15:16 -0400
"Benjamin A. Okopnik" <editor at linuxgazette.net> wrote:

Just to incoporate what you said about those that don't run Debian:

``
> ----- setclock ------------------------------------------------------
> #!/bin/bash
> # Created by Ben Okopnik on Tue Jul 20 20:30:58 EDT 2004

[ -f /etc/default/ntpdate ] &&
{
   . /etc/default/ntpdate
} || {
  [ -z "$NTPSERVERS" ] && NTPSERVERS="pool.ntp.org"
}
> 
> for n in $NTPSERVERS
> do
>         [ $UID -gt 0 ] && insert="-p"
>         echo -n "$n: "
>         /usr/sbin/rdate $insert $n
>         [ $? -eq 0 ] && exit
> done
> ----- setclock ------------------------------------------------------

``
> # Set the clock at 10 minutes after midnight, daily
> 10	0	*	*	*	/usr/local/bin/setclock>/dev/null
> ''

-- Thomas Adam

--
"Programming in Ruby is like being hugged." -- Greg McIntyre, Ruby
programmer.





More information about the TAG mailing list