aboutsummaryrefslogtreecommitdiff
path: root/hwclock
diff options
context:
space:
mode:
authorKurt J. Bosch <kjb-temp-2009@alpenjodel.de>2011-03-28 19:06:05 +0200
committerTom Gundersen <teg@jklm.no>2011-03-30 16:32:53 +0200
commit29a29c75e68bedd0b47d70de1e8eac83ffe23a13 (patch)
tree68685be6eed74ae2f7e320cc548431f04d3ee2a2 /hwclock
parente9b658239f45d858ff7b30b46441b8733d20f151 (diff)
downloadinitscripts-29a29c75e68bedd0b47d70de1e8eac83ffe23a13.tar.xz
Make hwclock --adjust as well as --systohc optional (FS#13684)
Signed-off-by: Tom Gundersen <teg@jklm.no>
Diffstat (limited to 'hwclock')
-rwxr-xr-xhwclock39
1 files changed, 39 insertions, 0 deletions
diff --git a/hwclock b/hwclock
new file mode 100755
index 0000000..d9de9e1
--- /dev/null
+++ b/hwclock
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+case $HARDWARECLOCK in
+ UTC) HWCLOCK_PARAMS="--utc";;
+ localtime) HWCLOCK_PARAMS="--localtime";;
+ *) HWCLOCK_PARAMS="";;
+esac
+
+case "$1" in
+ start)
+ if [[ $HWCLOCK_PARAMS ]]; then
+ status "Adjusting Hardware Clock" \
+ /sbin/hwclock --adjust
+ stat_busy "Setting System Clock"
+ /sbin/hwclock --hctosys $HWCLOCK_PARAMS || stat_die
+ stat_done
+ # Note: This also enables /etc/cron.hourly/adjtime
+ add_daemon hwclock
+ fi
+ ;;
+ stop)
+ if [[ $HWCLOCK_PARAMS ]]; then
+ stat_busy "Saving System Clock"
+ /sbin/hwclock --systohc $HWCLOCK_PARAMS || stat_die
+ stat_done
+ fi
+ rm_daemon hwclock
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac