aboutsummaryrefslogtreecommitdiff
path: root/adjtime.cron
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2009-08-15 23:55:25 -0500
committerThomas Bächler <thomas@archlinux.org>2009-08-22 11:25:27 +0200
commit2008846efe204b79d1c0f281d609a1f4b23431c8 (patch)
tree4b9404966d4593af87e609d9ad5b66129a16c9e5 /adjtime.cron
parentd1f86dbf7819a782df812dde8282a03ab1f82faf (diff)
downloadinitscripts-2008846efe204b79d1c0f281d609a1f4b23431c8.tar.xz
Allow skipping of all hardware clock adjustments
For virtualized machines, the hardware clock doesn't actually exist, so all hwclock calls fail and print error messages during system startup, shutdown, and the hourly adjtime cronjob. By explicitly looking for HARDWARECLOCK to be set to 'UTC' or 'localtime', all other values will result in hwclock calls being skipped (e.g. set the variable to 'none'). Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'adjtime.cron')
-rwxr-xr-xadjtime.cron18
1 files changed, 16 insertions, 2 deletions
diff --git a/adjtime.cron b/adjtime.cron
index 40c02f2..b1c8950 100755
--- a/adjtime.cron
+++ b/adjtime.cron
@@ -1,3 +1,17 @@
-#!/bin/sh
+#!/bin/bash
# Update our hwclock for system drift
-/sbin/hwclock --adjust
+
+. /etc/rc.conf
+
+HWCLOCK_PARAMS="--adjust"
+if [ "$HARDWARECLOCK" = "UTC" ]; then
+ HWCLOCK_PARAMS="$HWCLOCK_PARAMS --utc"
+elif [ "$HARDWARECLOCK" = "localtime" ]; then
+ HWCLOCK_PARAMS="$HWCLOCK_PARAMS --localtime"
+else
+ HWCLOCK_PARAMS=""
+fi
+
+if [ -n "$HWCLOCK_PARAMS" ]; then
+ /sbin/hwclock $HWCLOCK_PARAMS
+fi