|
Last change
on this file since 41104 was 41102, checked in by andy-1, 8 years ago |
|
fix Plugin install settime
|
-
Property svn:executable
set to
*
|
|
File size:
717 bytes
|
| Line | |
|---|
| 1 | #!/bin/bash
|
|---|
| 2 |
|
|---|
| 3 | start_hms=03:00:00
|
|---|
| 4 | #logfile=/dev/null
|
|---|
| 5 | logfile=/mnt/logs/settime.log
|
|---|
| 6 |
|
|---|
| 7 | #
|
|---|
| 8 | # convert time from HH:MM:SS to seconds
|
|---|
| 9 | #
|
|---|
| 10 |
|
|---|
| 11 | hms2sec() {
|
|---|
| 12 | hms_hh=`echo $1 | cut -f1 -d:`
|
|---|
| 13 | hms_mm=`echo $1 | cut -f2 -d:`
|
|---|
| 14 | hms_ss=`echo $1 | cut -f3 -d:`
|
|---|
| 15 | hms2sec_sec=`expr \( $hms_hh \* 60 + $hms_mm \) \* 60 + $hms_ss`
|
|---|
| 16 | }
|
|---|
| 17 |
|
|---|
| 18 | #
|
|---|
| 19 | # main
|
|---|
| 20 | #
|
|---|
| 21 |
|
|---|
| 22 | while [ 1 -eq 1 ] ; do
|
|---|
| 23 | ntpdate -b ptbtime1.ptb.de >>$logfile
|
|---|
| 24 | hms2sec `date "+%H:%M:%S"`
|
|---|
| 25 | now_sec=$hms2sec_sec
|
|---|
| 26 | hms2sec $start_hms
|
|---|
| 27 | start_sec=$hms2sec_sec
|
|---|
| 28 | sleep_sec=`expr 86400 + $start_sec - $now_sec`
|
|---|
| 29 | echo `date "+%d %b %H:%M:%S"` `basename $0`[$$]: set time again in $sleep_sec seconds >>$logfile
|
|---|
| 30 | sleep $sleep_sec
|
|---|
| 31 | done
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.