From 2008846efe204b79d1c0f281d609a1f4b23431c8 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sat, 15 Aug 2009 23:55:25 -0500 Subject: 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 --- adjtime.cron | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'adjtime.cron') 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 -- cgit v1.2.3