#!/bin/bash source `dirname $0`/../Sourcefile.sh printprocesslog "INFO starting $0" startdate=$1 stopdate=$2 name=$3 if [ "$1" = "" ] || [ "$2" = "" ] || [ "$3" = "" ] then echo "input missing" finish fi if [ $startdate -gt $stopdate ] then echo "start > stop -> exit" finish fi if [ "$4" = "x" ] then printprocesslog "setting ( ) for "$name" from "$startdate" to "$stopdate fi for (( i=0; i < 1000 ; i++)) do date=`date --date="${startdate} ${i}days" +%Y%m%d` if [ $date -gt $stopdate ] then break fi y=`echo $date | cut -c 1-4` m=`echo $date | cut -c 5-6` d=`echo $date | cut -c 7-8` if [ "$4" = "x" ] then query="UPDATE ToOcalendar.Data SET x=1 WHERE y="$y" AND m="$m"-1 AND d="$d" AND u='"$name"'" printprocesslog "INFO update x for "$date" and "$name else query="INSERT ToOcalendar.Data SET y="$y", m="$m"-1, d="$d", u='"$name"'" printprocesslog "INFO insert for "$date" and "$name fi sendquery >> /dev/null #echo $query done finish