Update netweork 'BLKR'.

This commit is contained in:
2018-10-15 01:04:40 +02:00
parent 27de2ec9b6
commit 7e2e43ffe7
248 changed files with 38711 additions and 11 deletions

23
BLKR/sbin/synctime Executable file
View File

@ -0,0 +1,23 @@
#!/bin/bash
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
NOW=$(date +%s)
INTERVAL=$[ 8 * 60 * 60 ] # 8 hs
CONTROL=/tmp/.lastSyncTime
sync_time() {
ntpdate-debian -s || exit 1
hwclock --systohc || exit 1
touch ${CONTROL}
}
[ ! -f ${CONTROL} ] && sync_time && exit 0
SYNCRONIZED=$(stat -c %Y ${CONTROL})
SECONDS=$[ ${NOW} - ${SYNCRONIZED} ]
[ ${SECONDS} -gt ${INTERVAL} ] && sync_time && exit 0
[ ${SECONDS} -lt 0 ] && sync_time && exit 0
exit 0