source: trunk/DataCheck/Tools/print_schedule.sh@ 19939

Last change on this file since 19939 was 19481, checked in by Daniela Dorner, 6 years ago
implemented start/stop date, improved logging
  • Property svn:executable set to *
File size: 2.6 KB
Line 
1#!/bin/bash
2#
3# Script to print FACT schedule
4#
5# Remarks:
6# make sure to use right setup for makeschedule
7# make sure that numdays is large enough to cover
8# from start to end
9
10# number of days to be treated
11numdays=731
12#numdays=7
13
14# time range
15start=20200101
16end=20201231
17
18
19# for XMM Newton
20schedulefile=/home/dorner/FACT.schedule/for.XMM/FACT-Schedule-for-XMM.txt
21mrk421file=/home/dorner/FACT.schedule/for.XMM/FACT-Schedule-Mrk421.txt
22mrk501file=/home/dorner/FACT.schedule/for.XMM/FACT-Schedule-Mrk501.txt
23mrk1959file=/home/dorner/FACT.schedule/for.XMM/FACT-Schedule-1959.txt
24# for INTEGRAL proposal
25schedulefile=/home/dorner/FACT.schedule/for.INTEGRAL.proposal/FACT-Schedule-for-XMM.txt
26mrk421file=/home/dorner/FACT.schedule/for.INTEGRAL.proposal/FACT-Schedule-Mrk421.txt
27mrk501file=/home/dorner/FACT.schedule/for.INTEGRAL.proposal/FACT-Schedule-Mrk501.txt
28mrk1959file=/home/dorner/FACT.schedule/for.INTEGRAL.proposal/FACT-Schedule-1959.txt
29
30#exit
31
32# filling file
33echo "# FACT Schedule from "`date --date="$start" +%Y-%m-%d`" till " `date --date="$end" +%Y-%m-%d` > $schedulefile
34echo "# FACT Schedule from "`date --date="$start" +%Y-%m-%d`" till " `date --date="$end" +%Y-%m-%d`
35
36# creating files for $numdays days (if they don't exist yet)
37for (( i=0; i < $numdays ; i++))
38do
39 date=`date --date="$start+${i}days" +%Y-%m-%d`
40 date2=`date --date="$start+${i}days" +%Y%m%d`
41 if [ $date2 -gt $end ]
42 then
43 continue
44 fi
45 #num=`~/SW/FACT++.2019.01.01/build/makeschedule $date 2>/dev/null | tail -9 | grep ^201 | grep -c SHUTDOWN`
46 ~/SW/FACT++.2019.01.01/build/makeschedule $date 2>/dev/null | sed -e '1,/SHUTDOWN/d' | grep ^20[12][0-9] >> $schedulefile
47 #echo ""
48done
49
50text=`cat $schedulefile`
51echo $text | grep -E -o "20[12][0-9]-[0-2][0-9]-[0-3][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9] Mrk 421 \[[0-9]{2,3}'; [0-9]{1,2}.[0-9]\/[0-9]{1,2}.[0-9]\] 20[12][0-9]-[0-2][0-9]-[0-3][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9]" | awk ' { print $1 " " $2 " - " $7 " " $8 " " $5 } ' | sed -e 's/;/]/' > $mrk421file
52echo $text | grep -E -o "20[12][0-9]-[0-2][0-9]-[0-3][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9] Mrk 501 \[[0-9]{2,3}'; [0-9]{1,2}.[0-9]\/[0-9]{1,2}.[0-9]\] 20[12][0-9]-[0-2][0-9]-[0-3][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9]" | awk ' { print $1 " " $2 " - " $7 " " $8 " " $5 } ' | sed -e 's/;/]/' > $mrk501file
53echo $text | grep -E -o "20[12][0-9]-[0-2][0-9]-[0-3][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9] 1ES 1959\+650 \[[0-9]{2,3}'; [0-9]{1,2}.[0-9]\/[0-9]{1,2}.[0-9]\] 20[12][0-9]-[0-2][0-9]-[0-3][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9]" | awk ' { print $1 " " $2 " - " $7 " " $8 " " $5 } ' | sed -e 's/;/]/' > $mrk1959file
54
Note: See TracBrowser for help on using the repository browser.