#!/bin/bash # Synchronize to a time server, since our clock is not accurate: # (Now done via ntpdate and ntpd.) #rdate -s timehost # Write the clock setting back to the CMOS clock: # (Cribbed from rc.sysinit file.) ARC=0 SRM=0 UTC=0 if [ -f /etc/sysconfig/clock ]; then . /etc/sysconfig/clock # convert old style clock config to new values if [ "${CLOCKMODE}" = "GMT" ]; then UTC=true elif [ "${CLOCKMODE}" = "ARC" ]; then ARC=true fi fi CLOCKFLAGS="--systohc" case "$UTC" in yes|true) CLOCKFLAGS="$CLOCKFLAGS -u"; ;; esac case "$ARC" in yes|true) CLOCKFLAGS="$CLOCKFLAGS -A"; ;; esac case "$SRM" in yes|true) CLOCKFLAGS="$CLOCKFLAGS -S"; ;; esac /sbin/hwclock $CLOCKFLAGS # Make sure we exit with success code, regardless of what happened: exit 0