| 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
|
|---|
| 11 | numdays=731
|
|---|
| 12 | #numdays=7
|
|---|
| 13 |
|
|---|
| 14 | # time range
|
|---|
| 15 | start=20200101
|
|---|
| 16 | end=20201231
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 | # for XMM Newton
|
|---|
| 20 | schedulefile=/home/dorner/FACT.schedule/for.XMM/FACT-Schedule-for-XMM.txt
|
|---|
| 21 | mrk421file=/home/dorner/FACT.schedule/for.XMM/FACT-Schedule-Mrk421.txt
|
|---|
| 22 | mrk501file=/home/dorner/FACT.schedule/for.XMM/FACT-Schedule-Mrk501.txt
|
|---|
| 23 | mrk1959file=/home/dorner/FACT.schedule/for.XMM/FACT-Schedule-1959.txt
|
|---|
| 24 | # for INTEGRAL proposal
|
|---|
| 25 | schedulefile=/home/dorner/FACT.schedule/for.INTEGRAL.proposal/FACT-Schedule-for-XMM.txt
|
|---|
| 26 | mrk421file=/home/dorner/FACT.schedule/for.INTEGRAL.proposal/FACT-Schedule-Mrk421.txt
|
|---|
| 27 | mrk501file=/home/dorner/FACT.schedule/for.INTEGRAL.proposal/FACT-Schedule-Mrk501.txt
|
|---|
| 28 | mrk1959file=/home/dorner/FACT.schedule/for.INTEGRAL.proposal/FACT-Schedule-1959.txt
|
|---|
| 29 |
|
|---|
| 30 | #exit
|
|---|
| 31 |
|
|---|
| 32 | # filling file
|
|---|
| 33 | echo "# FACT Schedule from "`date --date="$start" +%Y-%m-%d`" till " `date --date="$end" +%Y-%m-%d` > $schedulefile
|
|---|
| 34 | echo "# 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)
|
|---|
| 37 | for (( i=0; i < $numdays ; i++))
|
|---|
| 38 | do
|
|---|
| 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 ""
|
|---|
| 48 | done
|
|---|
| 49 |
|
|---|
| 50 | text=`cat $schedulefile`
|
|---|
| 51 | echo $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
|
|---|
| 52 | echo $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
|
|---|
| 53 | echo $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 |
|
|---|