|
1 | 1 | #!/bin/bash |
2 | 2 |
|
3 | 3 | line=`grep $1 $O2DPG_ROOT/DATA/production/configurations/$ALIEN_JDL_LPMANCHORYEAR/$O2DPGPATH/$ALIEN_JDL_LPMPASSNAME/ctf2epn.txt` |
4 | | -echo $line |
5 | | -epn=`echo $line | cut -d' ' -f1` |
6 | | -start=`echo $line | cut -d' ' -f2` |
7 | | -echo epn = $epn |
8 | | -echo start = $start |
9 | | - |
10 | | -lineTimes=`grep ${epn} $O2DPG_ROOT/DATA/production/configurations/$ALIEN_JDL_LPMANCHORYEAR/$O2DPGPATH/$ALIEN_JDL_LPMPASSNAME/goodITSMFT_fixed.txt` |
11 | | -echo lineTimes = $lineTimes |
12 | | -goodITS=`echo $lineTimes | cut -d' ' -f2` |
13 | | -echo goodITS = $goodITS |
14 | | -goodMFT=`echo $lineTimes | sed 's/^[0-9][0-9][0-9] \(2022-[0-9]*-[0-9]*-[0-9]*-[0-9]*-[0-9]*\) \(2022-[0-9]*-[0-9]*-[0-9]*-[0-9]*-[0-9]*\)/\2/'` |
15 | | -echo goodMFT = $goodMFT |
16 | | - |
17 | | -startmonth=`echo $start | cut -d'-' -f2` |
18 | | -startday=`echo $start | cut -d'-' -f3` |
19 | | -starthour=`echo $start | cut -d'-' -f4` |
20 | | -startminute=`echo $start | cut -d'-' -f5` |
21 | | -startsecond=`echo $start | cut -d'-' -f6` |
22 | | - |
23 | | -goodITSmonth=`echo $goodITS | cut -d'-' -f2` |
24 | | -goodITSday=`echo $goodITS | cut -d'-' -f3` |
25 | | -goodITShour=`echo $goodITS | cut -d'-' -f4` |
26 | | -goodITSminute=`echo $goodITS | cut -d'-' -f5` |
27 | | -goodITSsecond=`echo $goodITS | cut -d'-' -f6` |
28 | | - |
29 | | -goodMFTmonth=`echo $goodMFT | cut -d'-' -f2` |
30 | | -goodMFTday=`echo $goodMFT | cut -d'-' -f3` |
31 | | -goodMFThour=`echo $goodMFT | cut -d'-' -f4` |
32 | | -goodMFTminute=`echo $goodMFT | cut -d'-' -f5` |
33 | | -goodMFTsecond=`echo $goodMFT | cut -d'-' -f6` |
34 | | - |
35 | | -export remappingITS=0 |
36 | | -if [[ $startday < $goodITSday ]]; then |
37 | | - remappingITS=1 |
38 | | -elif [[ $starthour < $goodITShour ]]; then |
39 | | - remappingITS=1 |
40 | | -elif [[ $startminute < $goodITSminute ]]; then |
41 | | - remappingITS=1 |
42 | | -elif [[ $startsecond < $goodITSsecond ]]; then |
| 4 | +echo "line found in file = $line" |
| 5 | +if [[ -z $line ]]; then |
| 6 | + echo "CTF file not present in our list, no remapping needed" |
| 7 | + export remappingITS=0 |
| 8 | + export remappingMFT=0 |
| 9 | + echo "remappingITS = $remappingITS, remappingMFT = $remappingMFT" |
| 10 | +else |
| 11 | + epn=`echo $line | cut -d' ' -f1` |
| 12 | + start=`echo $line | cut -d' ' -f2` |
| 13 | + echo epn = $epn |
| 14 | + echo start = $start |
| 15 | + |
| 16 | + lineTimes=`grep ${epn} $O2DPG_ROOT/DATA/production/configurations/$ALIEN_JDL_LPMANCHORYEAR/$O2DPGPATH/$ALIEN_JDL_LPMPASSNAME/goodITSMFT_fixed.txt` |
| 17 | + echo lineTimes = $lineTimes |
| 18 | + goodITS=`echo $lineTimes | cut -d' ' -f2` |
| 19 | + echo goodITS = $goodITS |
| 20 | + goodMFT=`echo $lineTimes | sed 's/^[0-9][0-9][0-9] \(2022-[0-9]*-[0-9]*-[0-9]*-[0-9]*-[0-9]*\) \(2022-[0-9]*-[0-9]*-[0-9]*-[0-9]*-[0-9]*\)/\2/'` |
| 21 | + echo goodMFT = $goodMFT |
| 22 | + |
| 23 | + startmonth=`echo $start | cut -d'-' -f2` |
| 24 | + startday=`echo $start | cut -d'-' -f3` |
| 25 | + starthour=`echo $start | cut -d'-' -f4` |
| 26 | + startminute=`echo $start | cut -d'-' -f5` |
| 27 | + startsecond=`echo $start | cut -d'-' -f6` |
| 28 | + |
| 29 | + goodITSmonth=`echo $goodITS | cut -d'-' -f2` |
| 30 | + goodITSday=`echo $goodITS | cut -d'-' -f3` |
| 31 | + goodITShour=`echo $goodITS | cut -d'-' -f4` |
| 32 | + goodITSminute=`echo $goodITS | cut -d'-' -f5` |
| 33 | + goodITSsecond=`echo $goodITS | cut -d'-' -f6` |
| 34 | + |
| 35 | + goodMFTmonth=`echo $goodMFT | cut -d'-' -f2` |
| 36 | + goodMFTday=`echo $goodMFT | cut -d'-' -f3` |
| 37 | + goodMFThour=`echo $goodMFT | cut -d'-' -f4` |
| 38 | + goodMFTminute=`echo $goodMFT | cut -d'-' -f5` |
| 39 | + goodMFTsecond=`echo $goodMFT | cut -d'-' -f6` |
| 40 | + |
| 41 | + echo "good ITS: month = $goodITSmonth, day = $goodITSday, hour = $goodITShour, minute = $goodITSminute, seconds = $goodITSsecond" |
| 42 | + echo "good MFT: month = $goodMFTmonth, day = $goodMFTday, hour = $goodMFThour, minute = $goodMFTminute, seconds = $goodMFTsecond" |
| 43 | + echo "checking: month = $startmonth, day = $startday, hour = $starthour, minute = $startminute, seconds = $startsecond" |
| 44 | + |
| 45 | + if [[ $startday < $goodITSday ]]; then |
| 46 | + echo "day triggers remappingITS" |
43 | 47 | remappingITS=1 |
44 | | -fi |
| 48 | + elif [[ $startday == $goodITSday ]]; then |
| 49 | + if [[ $starthour < $goodITShour ]]; then |
| 50 | + echo "hour triggers remappingITS" |
| 51 | + remappingITS=1 |
| 52 | + elif [[ $starthour == $goodITShour ]]; then |
| 53 | + if [[ $startminute < $goodITSminute ]]; then |
| 54 | + echo "minute triggers remappingITS" |
| 55 | + remappingITS=1 |
| 56 | + elif [[ $startminute == $goodITSminute ]]; then |
| 57 | + if [[ $startsecond -le $goodITSsecond ]]; then |
| 58 | + echo "second triggers remappingITS" |
| 59 | + remappingITS=1 |
| 60 | + else |
| 61 | + echo "day, hour, minute would trigger remapping, but seconds are larger than what is needed to trigger remapping for ITS" |
| 62 | + fi |
| 63 | + else |
| 64 | + echo "day, hour would trigger remapping, but minutes are larger than what is needed to trigger remapping for ITS" |
| 65 | + fi |
| 66 | + else |
| 67 | + echo "day would trigger remapping, but minutes are larger than what is needed to trigger remapping for ITS" |
| 68 | + fi |
| 69 | + else |
| 70 | + echo "start day is later than what is needed to trigger remapping for ITS" |
| 71 | + fi |
45 | 72 |
|
46 | | -export remappingMFT=0 |
47 | | -if [[ $startday < $goodMFTday ]]; then |
48 | | - remappingMFT=1 |
49 | | -elif [[ $starthour < $goodMFThour ]]; then |
50 | | - remappingMFT=1 |
51 | | -elif [[ $startminute < $goodMFTminute ]]; then |
| 73 | + if [[ $startday < $goodMFTday ]]; then |
| 74 | + echo "day triggers remappingMFT" |
52 | 75 | remappingMFT=1 |
53 | | -elif [[ $startsecond < $goodMFTsecond ]]; then |
54 | | - remappingMFT=1 |
55 | | -fi |
56 | | - |
57 | | -echo "start = $start, goodITS = $goodITS, goodMFT = $goodMFT, remappingITS = $remappingITS, remappingMFT = $remappingMFT" |
| 76 | + elif [[ $startday == $goodMFTday ]]; then |
| 77 | + if [[ $starthour < $goodMFThour ]]; then |
| 78 | + echo "hour triggers remappingMFT" |
| 79 | + remappingMFT=1 |
| 80 | + elif [[ $starthour == $goodMFThour ]]; then |
| 81 | + if [[ $startminute < $goodMFTminute ]]; then |
| 82 | + echo "minute triggers remappingMFT" |
| 83 | + remappingMFT=1 |
| 84 | + elif [[ $startminute == $goodMFTminute ]]; then |
| 85 | + if [[ $startsecond -le $goodMFTsecond ]]; then |
| 86 | + echo "second triggers remappingMFT" |
| 87 | + remappingMFT=1 |
| 88 | + else |
| 89 | + echo "day, hour, minute would trigger remapping, but seconds are larger than what is needed to trigger remapping for MFT" |
| 90 | + fi |
| 91 | + else |
| 92 | + echo "day, hour would trigger remapping, but minutes are larger than what is needed to trigger remapping for MFT" |
| 93 | + fi |
| 94 | + else |
| 95 | + echo "day would trigger remapping, but minutes are larger than what is needed to trigger remapping for MFT" |
| 96 | + fi |
| 97 | + else |
| 98 | + echo "start day is later than what is needed to trigger remapping for MFT" |
| 99 | + fi |
58 | 100 |
|
| 101 | + echo "start = $start, goodITS = $goodITS, goodMFT = $goodMFT, remappingITS = $remappingITS, remappingMFT = $remappingMFT" |
| 102 | +fi |
59 | 103 |
|
60 | 104 |
|
0 commit comments