blob: 9e5992c39f06ee6b930c9a1abbd3ae9bb7a511f6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
<sect1 id="ch07-setclock">
<title>Creating the setclock script</title>
<para>
The following script is only for real use when your hardware clock (also
known as BIOS or CMOS clock) isn't set to GMT time. The recommended
setup is setting your hardware clock to GMT and have the time converted
to localtime using the /etc/localtime symbolic link. But if you run an
OS that doesn't understand a clock set to GMT (most notable are
Microsoft OS'es) you might want to set your clock to localtime so that
the time is properly displayed on those OS'es. This script will reset
the kernel time to the hardware clock without converting the time using
the /etc/localtime symlink.
</para>
<para>
If you want to use this script on your system even if you have your
hardware clock set to GMT, then change the UTC variable below to the
value of <emphasis>1</emphasis>.
</para>
<literallayout>
<userinput>cat > setclock << "EOF"</userinput>
#!/bin/sh
# Begin /etc/init.d/setclock
#
# Include the functions declared in the /etc/init.d/functions file
# and include the variables from the /etc/sysconfig/clock file
#
source /etc/init.d/functions
source /etc/sysconfig/clock
#
# Right now we want to set the kernel clock according to the hardware
# clock, so we use the -hctosys parameter.
#
CLOCKPARAMS="--hctosys"
#
# If the UTC variable is set in the /etc/sysconfig/clock file, add the
# -u parameter as well which tells hwclock that the hardware clock is
# set to UTC time instead of local time.
#
case "$UTC" in
yes|true|1)
CLOCKPARAMS="$CLOCKPARAMS -u"
;;
esac
echo -n "Setting clock..."
/sbin/hwclock $CLOCKPARAMS
evaluate_retval
# End /etc/init.d/setclock
<userinput>EOF</userinput>
</literallayout>
<sect2>
<title>Creating the /etc/sysconfig/clock file</title>
<para>
Create a new file <filename>/etc/sysconfig/clock</filename> by running
the following:
</para>
<literallayout>
<userinput>cat > /etc/sysconfig/clock << "EOF"</userinput>
# Begin /etc/sysconfig/clock
UTC=1
# End /etc/sysconfig/clock
<userinput>EOF</userinput>
</literallayout>
<para>
If your hardware clock (also known as BIOS or CMOS clock) is not set to
GMT time, than set the UTC variable in the /etc/sysconfig/clock file to
the value <emphasis>0</emphasis> (zero).
</para>
</sect2>
</sect1>
|