source: trunk/DataCheck/Monitoring/ToOVisibility.sh

Last change on this file was 18864, checked in by Daniela Dorner, 8 years ago
added (tools to fill satellite visibilities for our sources to the ToO calendar)
  • Property svn:executable set to *
File size: 1.0 KB
Line 
1#!/bin/bash
2
3
4source `dirname $0`/../Sourcefile.sh
5printprocesslog "INFO starting $0"
6
7startdate=$1
8stopdate=$2
9name=$3
10
11if [ "$1" = "" ] || [ "$2" = "" ] || [ "$3" = "" ]
12then
13 echo "input missing"
14 finish
15fi
16
17if [ $startdate -gt $stopdate ]
18then
19 echo "start > stop -> exit"
20 finish
21fi
22
23if [ "$4" = "x" ]
24then
25 printprocesslog "setting ( ) for "$name" from "$startdate" to "$stopdate
26fi
27
28
29
30for (( i=0; i < 1000 ; i++))
31do
32 date=`date --date="${startdate} ${i}days" +%Y%m%d`
33 if [ $date -gt $stopdate ]
34 then
35 break
36 fi
37 y=`echo $date | cut -c 1-4`
38 m=`echo $date | cut -c 5-6`
39 d=`echo $date | cut -c 7-8`
40
41 if [ "$4" = "x" ]
42 then
43 query="UPDATE ToOcalendar.Data SET x=1 WHERE y="$y" AND m="$m"-1 AND d="$d" AND u='"$name"'"
44 printprocesslog "INFO update x for "$date" and "$name
45 else
46 query="INSERT ToOcalendar.Data SET y="$y", m="$m"-1, d="$d", u='"$name"'"
47 printprocesslog "INFO insert for "$date" and "$name
48 fi
49 sendquery >> /dev/null
50 #echo $query
51done
52
53finish
54
Note: See TracBrowser for help on using the repository browser.