#!/bin/bash # # script to check whether the time of the computer is off # offset is inserted into the database # offset=`/usr/sbin/ntpdate -d ptbtime1.ptb.de 2>/dev/null | grep '^offset*' | cut -d' ' -f2` query="INSERT NTPDate set fOffset="$offset", fMachineKEY=(SELECT fMachineKEY from Machine WHERE fMachineName='"$HOSTNAME"'), fTime=Now()" # host needs full address to work also on fact01 /usr/bin/mysql -u systemstatus --host=fact01.ethz.ch SystemStatus -e "$query"