source: trunk/DataCheck/Monitoring/InsertSchedule.sh@ 19449

Last change on this file since 19449 was 19401, checked in by Daniela Dorner, 6 years ago
fixed FACT++ path
  • Property svn:executable set to *
File size: 2.2 KB
Line 
1#!/bin/bash
2
3
4source `dirname $0`/../Sourcefile.sh
5printprocesslog "INFO starting $0"
6
7# get dates
8if [ "$certaindate" != "" ]
9then
10 getdates $certaindate
11else
12 if [ "$1" = "" ]
13 then
14 # the day after tomorrow
15 dates=( `date +%Y/%m/%d --date="+1day" --utc` )
16 else
17 getdates $1
18 fi
19fi
20
21
22
23for date in ${dates[@]}
24do
25 printprocesslog "INFO insert schedule for the night of "$date
26 #echo "INFO inserting schedule for the night of "$date
27 date2=`echo $date | sed -e 's/\//-/g'`
28 year=`echo $date | cut -c 1-4`
29 month=`echo $date | cut -c 6-7`
30 day=`echo $date | cut -c 9-10`
31 query="SELECT u FROM calendar.Data WHERE y="$year" AND m="$month"-1 AND d="$day" AND u NOT IN ('ETHZ','TUDO','ISDC','UNIWUE')"
32 printprocesslog "DEBUG "$query
33 #echo "DEBUG "$query
34 shifters=`sendquery`
35 if [ "$shifters" = "" ]
36 then
37 printprocesslog "INFO No shifter found in calendar -> Do not insert a schedule."
38 echo "INFO No shifter found in calendar -> Do not insert a schedule."
39 continue
40 else
41 checkshifter=`echo $shifters | grep moon`
42 if [ "$checkshifter" != "" ]
43 then
44 printprocesslog "INFO Full moon night -> Do not insert a schedule."
45 #echo "INFO Full moon night -> Do not insert a schedule."
46 continue
47 fi
48 fi
49
50 printprocesslog "DEBUG /home/fact/operation/makeschedule --config /home/fact/makeschedule_gate.rc --date $date2 --enter-schedule-into-database true 2>/dev/null | grep 'Schedule entered successfully into database.\|Schedule not empty.'"
51 check=`/home/fact/operation/makeschedule --config /home/fact/makeschedule_gate.rc --date $date2 --enter-schedule-into-database true 2>/dev/null | grep 'Schedule entered successfully into database.\|Schedule not empty.'`
52 case $check in
53 "Schedule entered successfully into database.")
54 printprocesslog "INFO schedule for "$date2" successfully inserted. "
55 ;;
56 "Schedule not empty.")
57 printprocesslog "WARN schedule for "$date2" not empty -> cannot insert schedule."
58 ;;
59 *)
60 printprocesslog "ERROR problem with inserting schedule for "$date" ("$check")"
61 ;;
62 esac
63done
64
65finish
Note: See TracBrowser for help on using the repository browser.