source: trunk/DataCheck/Monitoring/CheckSwiftSchedule.sh@ 18420

Last change on this file since 18420 was 18420, checked in by Daniela Dorner, 9 years ago
added (script to check swift schedule for observations of our sources)
  • Property svn:executable set to *
File size: 1.5 KB
Line 
1#!/bin/bash
2
3
4sources=( "Mrk 421" "Mkn 421" "1959" "V404" "0323" "Crab" "CRAB" "Mrk 501" "Mkn 501" )
5
6dates=(`date +"%Y-%m-%d" --date="-12hour"` `date +%Y-%m-%d --date="+12hour"`)
7
8date2=`echo ${dates[0]} | sed -e 's/-/\//g'`
9schedulepath=/home/factwww/scheduling/$date2
10schedulefile=$schedulepath/swift.schedule
11schedulefile2=$schedulepath/swift.schedule.formated
12schedulefile3=$schedulepath/swift.schedule.txt
13
14# Get Swift Data
15echo "" > $schedulefile
16
17#echo "Downloading the schedule for..."
18for date in ${dates[@]}
19do
20 #echo " "$date"..."
21 lynx -width 200 -nolist -dump https://www.swift.psu.edu/operations/obsSchedule.php?d=$date | grep $date >> $schedulefile
22done
23
24cat $schedulefile | sed -r -e 's/[0-9]{5}\ \ \ [0-9]{1,3}\ \ \ //' | grep -o -E '^\ \ \ \ 20[1-9][0-9]-[01][0-9]-[0-3][0-9]\ [0-9][0-9]:[0-9][0-9]:[0-9][0-9]\ \ \ 20[1-9][0-9]-[01][0-9]-[0-3][0-9]\ [0-9][0-9]:[0-9][0-9]:[0-9][0-9]\ \ \ [A-Z1-4]([A-Za-z0-9][\ \.\+\-]?){3,20}' > $schedulefile2
25
26#echo ""
27echo -n "Searched the schedule for the following source names: " >$schedulefile3
28for (( i=0; i<${#sources[@]}; i++ ))
29do
30 echo -n ${sources[$i]} >>$schedulefile3
31 i2=`echo " $i + 1" | bc -l`
32 if [ $i2 -lt ${#sources[@]} ]
33 then
34 echo -n ", " >>$schedulefile3
35 else
36 echo "" >>$schedulefile3
37 fi
38done
39for (( i=0; i<${#sources[@]}; i++ ))
40do
41 grep "${sources[$i]}" $schedulefile2 >>$schedulefile3
42done
43
44echo -e "\nThe full schedule can be found <a href='../scheduling/"$date2"/"`basename $schedulefile2`"'>here</a>\n" >>$schedulefile3
45
Note: See TracBrowser for help on using the repository browser.