|
4 | 4 | # This script executes all the plots available at the same time |
5 | 5 | # with the same arguments. |
6 | 6 |
|
7 | | -# Python command |
| 7 | +# Defaults |
8 | 8 | PyEx='python3' |
| 9 | +Size='22x10' |
| 10 | +pDays='30' |
| 11 | +EndDT=$(date +"%d-%m-%y") |
| 12 | + |
| 13 | +while getopts s:p:e: flag; do |
| 14 | + case "${flag}" in |
| 15 | + s) |
| 16 | + Size=$(grep -oP '\d+x\d+' <<< ${OPTARG}) |
| 17 | + ;; |
| 18 | + p) |
| 19 | + pDays=$(grep -oP '\d+' <<< ${OPTARG}) |
| 20 | + ;; |
| 21 | + e) |
| 22 | + EndDT=$(grep -oP '\d+-\w+-\d+' <<< ${OPTARG}) |
| 23 | + ;; |
| 24 | + *) |
| 25 | + echo "ERROR: Invalid argument flag" && exit -1 |
| 26 | + ;; |
| 27 | + esac |
| 28 | +done |
| 29 | + |
| 30 | +# Set X and Y size |
| 31 | +Xcm=$(cut -dx -f1 <<< $Size) |
| 32 | +Ycm=$(cut -dx -f2 <<< $Size) |
| 33 | +XnY="-W $Xcm -H $Ycm" |
9 | 34 |
|
10 | | -# X and Y wide and height for fit all plots together on the screen |
11 | | -if [ -z "$1" ]; then |
12 | | - XargY='22x10' |
13 | | -else |
14 | | - XargY=`grep -oP '\d+x\d+' <<<$1` |
15 | | -fi |
16 | | -Xcm=`cut -dx -f1 <<< $XargY` |
17 | | -Ycm=`cut -dx -f2 <<< $XargY` |
18 | | -
|
19 | | -# Days ago |
20 | | -if [ -z "$2" ]; then |
21 | | - Past='30' |
22 | | -else |
23 | | - Past=`grep -oP '\d+' <<<$2` |
24 | | -fi |
25 | | -
|
26 | | -# End Date |
27 | | -if [ -z "$3" ]; then |
28 | | - EndDate='' |
29 | | -else |
30 | | - EndDate="-e `grep -oP '\d+-\w+-\d+' <<<$3`" |
31 | | -fi |
32 | | -
|
33 | | -echo "Execution: $0 [Width x Height] [Past Days] [End Date]" |
34 | | -echo "Example: $0 22x10 30 31-Dec-20" |
| 35 | +echo "Execution: $0 [-s Width x Height] [ -p Past Days] [ -e End Date]" |
| 36 | +echo "Example: $0 -s 22x10 -p 30 -e 31-Dec-20" |
35 | 37 | echo "" |
36 | | -if [ -z "$XargY" ] || [ -z "$Past" ]; then exit; fi |
37 | 38 |
|
38 | | -echo -e "Making 4 plots in backgroud...\n" |
39 | | -echo -e "Wide x Height:\t${Xcm}x${Ycm}" |
40 | | -XnY="-W $Xcm -H $Ycm" |
41 | | -$PyEx ./tuptime-plot1.py $XnY $EndDate -p $Past > /dev/null & |
42 | | -$PyEx ./tuptime-plot1.py $XnY $EndDate -p $Past -x > /dev/null & |
43 | | -$PyEx ./tuptime-plot2.py $XnY $EndDate -p $Past > /dev/null & |
44 | | -$PyEx ./tuptime-plot2.py $XnY $EndDate -p $Past -x |
| 39 | +echo -e "Making 4 plots in background...\n" |
| 40 | +echo -e "Wide x Height:\t ${Xcm}x${Ycm}" |
| 41 | +echo -e "Past Days:\t ${pDays}" |
| 42 | +echo -e "End Date:\t ${EndDT}\n" |
| 43 | + |
| 44 | +$PyEx ./tuptime-plot1.py $XnY -e $EndDT -p $pDays > /dev/null & |
| 45 | +$PyEx ./tuptime-plot1.py $XnY -e $EndDT -p $pDays -x > /dev/null & |
| 46 | +$PyEx ./tuptime-plot2.py $XnY -e $EndDT -p $pDays > /dev/null & |
| 47 | +$PyEx ./tuptime-plot2.py $XnY -e $EndDT -p $pDays -x |
0 commit comments