Index: /ipk/source/tools_settime/mnt/config/usercmd.sh
===================================================================
--- /ipk/source/tools_settime/mnt/config/usercmd.sh	(revision 41102)
+++ /ipk/source/tools_settime/mnt/config/usercmd.sh	(revision 41102)
@@ -0,0 +1,6 @@
+#!/bin/sh
+# start the user commands here
+echo "[usercmd.sh] start"
+/mnt/script/settime.sh&
+
+exit
Index: /ipk/source/tools_settime/mnt/script/settime.sh
===================================================================
--- /ipk/source/tools_settime/mnt/script/settime.sh	(revision 41102)
+++ /ipk/source/tools_settime/mnt/script/settime.sh	(revision 41102)
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+start_hms=03:00:00
+#logfile=/dev/null
+logfile=/mnt/logs/settime.log
+
+#
+# convert time from HH:MM:SS to seconds
+#
+
+hms2sec() {
+    hms_hh=`echo $1 | cut -f1 -d:`
+    hms_mm=`echo $1 | cut -f2 -d:`
+    hms_ss=`echo $1 | cut -f3 -d:`
+    hms2sec_sec=`expr \( $hms_hh \* 60 + $hms_mm \) \* 60 + $hms_ss`
+}
+
+#
+# main
+#
+
+    while [ 1 -eq 1 ] ; do
+        ntpdate -b ptbtime1.ptb.de >>$logfile
+        hms2sec `date "+%H:%M:%S"`
+        now_sec=$hms2sec_sec
+        hms2sec $start_hms
+        start_sec=$hms2sec_sec
+        sleep_sec=`expr 86400 + $start_sec - $now_sec`
+        echo `date "+%d %b %H:%M:%S"` `basename $0`[$$]: set time again in $sleep_sec seconds >>$logfile
+        sleep $sleep_sec
+    done
