source: branches/trigger_burst_research/Monitoring/CheckNTPDate.sh@ 19875

Last change on this file since 19875 was 17529, checked in by Daniela Dorner, 11 years ago
minor changes in db query
  • Property svn:executable set to *
File size: 609 bytes
Line 
1#!/bin/bash
2#
3# script to check whether the time of the computer is off
4# offset is inserted into the database
5#
6
7offset=`/usr/sbin/ntpdate -d ptbtime1.ptb.de 2>/dev/null | grep '^offset*' | cut -d' ' -f2`
8query="INSERT NTPDate SET fOffset="$offset", fMachineKEY=(SELECT fMachineKEY FROM Machine WHERE fMachineName='"$HOSTNAME"'), fTime=Now()"
9# host needs full address to work also on fact01
10/usr/bin/mysql -u systemstatus --host=fact01.fact.local systemstatus -e "$query"
11
12if [ $(echo " $offset > 1 || $offset < -1 " | bc) -eq 1 ]
13then
14 echo `date`": time difference of "$offset" sec on "$HOSTNAME
15fi
16
Note: See TracBrowser for help on using the repository browser.