#!/bin/sh PATH=/sbin:/usr/sbin:/bin:/usr/bin PROG="`basename "$0"`" DEV="/dev/rtc1" usage() { echo >&2 "Usage: $PROG [start|status|restart|force-reload|status]" exit 2 # "invalid or excess arguments" } if [ $# -ne 1 ] ; then usage ; fi start() { if [ ! -c "$DEV" ] ; then echo ds3231 0x68 >/sys/class/i2c-adapter/i2c-2/new_device if [ $? -ne 0 -o ! -c "$DEV" ] ; then echo >&2 "failed to load RTC driver" exit 1 fi fi pidof ntpd >/dev/null if [ $? -eq 0 ] ; then return ; fi hwclock -f "$DEV" --hctosys } case "$1" in start) start ;; stop) ;; restart) start ;; force-reload) start ;; status) ;; *) usage ;; esac exit 0