Re: How to keep date/time accurate

From: Cobra (mtcobra_at_gmx.de)
Date: 10/06/03


Date: Mon, 6 Oct 2003 17:12:19 +0200

Created a file called gettime (or anything like that) in the /etc/init.d
folder with the following code in it. Activate gettime for runlevel 3 and 5
in the runlevel editor. Then the correct time will be set on startup. An
internet connection must be available at this time!
Don't if that's the best way to do it, but it works ;)

#! /bin/sh
#
# Author: Markus Thiel, 2002
#
# /etc/init.d/gettime
#
### BEGIN INIT INFO
# Provides: gettime
# Required-Start: network route nscd
# Required-Stop:
# Default-Start: 3 5
# Default-Stop: 3 5
# Description: corrects system time
### END INIT INFO

. /etc/rc.status

function error()
{
rc_status -v
exit 0
}

echo -n "getting accurate time"

ping -c 1 -w 10 217.5.113.240 > /dev/null || error

netdate 130.149.17.21 tcp 134.60.1.111 > /dev/null

rc_status -v



Relevant Pages

  • Re: [SLE] Permanant bridge
    ... Yast/System/Runlevel editor to enable it. ... And then the runlevel editor then creates ... # Required-Start: $syslog $remote_fs ... You need to figure out and provide the proper ...
    (SuSE)
  • Re: any script added to init.d is LIFO
    ... What you are asking is to have YaST start it after the script ... This position is always first in the runlevel. ... # Required-Stop: ...
    (alt.os.linux.suse)
  • any script added to init.d is LIFO
    ... I was trying to setup a script in init.d and control when it fires. ... This position is always first in the runlevel. ...
    (alt.os.linux.suse)