]> git.pld-linux.org Git - packages/rdate.git/blame - rdate.cron
- experimental SYNC_HWCLOCK support
[packages/rdate.git] / rdate.cron
CommitLineData
0e12f878
TO
1#!/bin/sh
2
3# Source function library.
4. /etc/rc.d/init.d/functions
5
6# Source networking configuration.
7. /etc/sysconfig/network
8
9# Get service config
d07ff775 10if [ -f /etc/sysconfig/rdate ]; then
0e12f878
TO
11 . /etc/sysconfig/rdate
12fi
13
14# Check that networking is up.
83c84c80
TO
15if [ is_yes "${NETWORKING}" -a is_yes "${SET_TIME}" -a -n "${RDATE_SERVERS}" ]; then
16 /usr/bin/rdate -s "${RDATE_SERVERS}"
17 if [ $? -eq 0 -a is_yes "${SYNC_HWCLOCK}" -a -x /sbin/hwclock ]; then
18 # Set the system clock.
19 ARC=0
20 SRM=0
21 UTC=0
22
23 if [ -f /etc/sysconfig/clock ]; then
24 . /etc/sysconfig/clock
25
26 # convert old style clock config to new values
27 if [ "${CLOCKMODE}" = "GMT" ]; then
28 UTC=true
29 elif [ "${CLOCKMODE}" = "ARC" ]; then
30 ARC=true
31 fi
32 fi
33
34 if grep "system serial" /proc/cpuinfo | grep -q MILO ; then
35 ARC=true
36 fi
37
38 CLOCKFLAGS="--systohc"
39
40 if is_yes "$UTC" ; then
41 CLOCKFLAGS="$CLOCKFLAGS --utc"
42 else
43 CLOCKFLAGS="$CLOCKFLAGS --localtime"
44 fi
45
46 if is_yes "$ARC" ; then
47 CLOCKFLAGS="$CLOCKFLAGS -A"
48 fi
49
50 if is_yes "$SRM" ; then
51 CLOCKFLAGS="$CLOCKFLAGS -S"
52 fi
53
54 /sbin/hwclock $CLOCKFLAGS
55 fi
0e12f878 56fi
This page took 0.082487 seconds and 4 git commands to generate.