-
Notifications
You must be signed in to change notification settings - Fork 0
/
updateSSTWebpage.sh
executable file
·113 lines (93 loc) · 3.7 KB
/
updateSSTWebpage.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/bin/bash
source $HOME/.telegram
Verbose=0
SoloSube=0 #Si es 1 solo sube los datos. Si es 0 actualiza y sube los datos
PaginaWebDir=$HOME/Analisis/SSTWebpage
DirLog=$PaginaWebDir/log
strval=$(uname -a)
if [[ $strval == *Okapi* ]];
then
MatVersion=/Applications/MATLAB_R2019b.app/bin/matlab
fi
if [[ $strval == *rossby* ]];
then
MatVersion=/usr/bin/matlab
fi
#------------------------------------
#Inicio
#------------------------------------
/bin/rm -f $DirLog/*.log
printf ">>>> Updating PaginaWeb SSTs \n"
printf " Verbose $Verbose SoloSube $SoloSube \n"
printf " PaginaWebDir $PaginaWebDir \n"
printf " DirLog $DirLog \n"
#------------------------------------
#Actualiza datos SST
#------------------------------------
if [ $SoloSube == 0 ]
then
printf "Updating SST dataset for the region\n"
if [ $Verbose -eq 1 ]
then
cd $PaginaWebDir; $MatVersion -nodisplay -nosplash -r 'updateNoaaOisstV2HighresData;exit'
else
cd $PaginaWebDir; $MatVersion -nodisplay -nosplash -r 'updateNoaaOisstV2HighresData;exit' > $DirLog/updateNoaaOisstV2HighresData.log
fi
fi
#------------------------------------
# Actualizo la base datos de SST en las estaciones Raprocan
#------------------------------------
printf "Updating SST\n"
if [ $Verbose == 1 ]
then
cd $PaginaWebDir; $MatVersion -nodisplay -nosplash -r 'createSSTData;exit'
else
cd $PaginaWebDir; $MatVersion -nodisplay -nosplash -r 'createSSTData;exit' > $DirLog/createSSTNorteTenerife.log
fi
#if [ $Verbose == 1 ]
#then
# cd $PaginaWebDir; $MatVersion -nodisplay -nosplash -r 'createSSTNorteTenerife;exit'
#else
# cd $PaginaWebDir; $MatVersion -nodisplay -nosplash -r 'createSSTNorteTenerife;exit' > $DirLog/createSSTNorteTenerife.log
#fi
#printf "Updating SSTRaprocan\n"
#if [ $Verbose == 1 ]
#then
# cd $PaginaWebDir; $MatVersion -nodisplay -nosplash -r 'createSSTRaprocan;exit'
#else
# cd $PaginaWebDir; $MatVersion -nodisplay -nosplash -r 'createSSTRaprocan;exit' > $DirLog/createSSTRaprocan.log
#fi
#------------------------------------
# Anual and Ciclo estacional y Hovmoller plots
#------------------------------------
printf "Updating seasonal cycle\n"
if [ $Verbose == 1 ]
then
cd $PaginaWebDir; $MatVersion -nodisplay -nosplash -r 'createSSTfigures_yearly;exit'
else
cd $PaginaWebDir; $MatVersion -nodisplay -nosplash -r 'createSSTfigures_yearly;exit' > $DirLog/createSSTfigures_yearly.log
fi
printf "Updating hovmoller plotsa\n"
if [ $Verbose == 1 ]
then
cd $PaginaWebDir; $MatVersion -nodisplay -nosplash -r 'createSSTfigures;exit'
else
cd $PaginaWebDir; $MatVersion -nodisplay -nosplash -r 'createSSTfigures;exit' > $DirLog/createSSTfigures.log
fi
printf "Updating reports\n"
if [ $Verbose == 1 ]
then
cd $PaginaWebDir; $MatVersion -nodisplay -nosplash -r 'createReport;exit'
else
cd $PaginaWebDir; $MatVersion -nodisplay -nosplash -r 'createReport;exit' > $DirLog/createReport.log
fi
#------------------------------------
# i TelegramBot
#------------------------------------
URL="https://api.telegram.org/bot$ArgoEsBotTOKEN/sendMessage"
URLimg="https://api.telegram.org/bot$ArgoEsBotTOKEN/sendphoto?chat_id=$ArgoEsChannel"
MENSAJE=`cat $HOME/Analisis/SSTWebpage/data/report.txt`
curl -s -X POST $URL -d chat_id=$ArgoEsChannel -d text="$MENSAJE" -d parse_mode=html > $DirLog/bot.log
curl -F "photo=@$HOME/Analisis/SSTWebpage/images/GraficosSSTNorteTenerife_CicloEstacional_Seccion01_02.png" $URLimg -F caption="GraficosSSTNorteTenerife_CicloEstacional"
curl -F "photo=@$HOME/Analisis/SSTWebpage/images/GraficosSSTNorteTenerife_Anual_Seccion01_02.png" $URLimg -F caption="GraficosSSTNorteTenerife_Anual"
curl -F "photo=@$HOME/Analisis/SSTWebpage/images/GraficosSSTNorteTenerife_Mensual_Seccion01_02.png" $URLimg -F caption="GraficosSSTNorteTenerife_Mensual"