aboutsummaryrefslogtreecommitdiffstats
path: root/chapter07/setclock.xml
diff options
context:
space:
mode:
authorGerard Beekmans <gerard@linuxfromscratch.org>2001-02-15 15:26:52 +0000
committerGerard Beekmans <gerard@linuxfromscratch.org>2001-02-15 15:26:52 +0000
commitb08f4096533577934b885fa9df41d3881d141612 (patch)
tree8e5ffc0ba65ac34d97cd6a896d33b85a897a6da8 /chapter07/setclock.xml
parentad08014624938a3a3bfd1b44e8b27d02c7b06dd8 (diff)
Initial XML commit
git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@174 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
Diffstat (limited to 'chapter07/setclock.xml')
-rw-r--r--chapter07/setclock.xml93
1 files changed, 93 insertions, 0 deletions
diff --git a/chapter07/setclock.xml b/chapter07/setclock.xml
new file mode 100644
index 000000000..9e5992c39
--- /dev/null
+++ b/chapter07/setclock.xml
@@ -0,0 +1,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 &gt; setclock &lt;&lt; "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 &gt; /etc/sysconfig/clock &lt;&lt; "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>
+