Skip to content
Snippets Groups Projects

Pouvoir calculer les indicateurs à tous les jours

Merged Olivier Maury requested to merge compute-daily-values into main
1 file
+ 19
1
Compare changes
  • Side-by-side
  • Inline
@@ -8,6 +8,7 @@ function usage {
echo " Environment variables AGROMETINFO_ACTIVEMQ_USER and AGROMETINFO_ACTIVEMQ_PASSWORD must be set."
echo "OPTIONS"
echo " -h show usage"
echo " -f force, do not ask confirmation"
echo " -c compute each date"
echo " -l <DATE> send to localhost"
echo " -p <DATE> send to pre-production"
@@ -22,21 +23,28 @@ if [[ -z "$AGROMETINFO_ACTIVEMQ_PASSWORD" ]]; then
exit 1
fi
while getopts ":chl:p:" option
while getopts ":cfhl:p:" option
do
case "${option}" in
c)
COMPUTE_EACH_DATE='true'
;;
f)
FORCE='true'
;;
h)
usage
exit 0
;;
l)
COLOR="\033[32;1;7m"
PROFILE=localhost
URL='http://localhost:8161/console/jolokia/'
DATE=$OPTARG
;;
p)
COLOR="\033[33;1;7m"
PROFILE=preprod
URL='http://agrometinfo-preprod:8161/console/jolokia/'
DATE=$OPTARG
;;
@@ -58,6 +66,16 @@ if [[ -z "$DATE" ]]; then
exit 1
fi
if [[ -z "$FORCE" ]]; then
echo -e "Are you sure to send $DATE to $COLOR$URL\033[0m ($COLOR$PROFILE\033[0m)? (y/N)"
read -p "" -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo "Sending is cancelled!";
exit 0;
fi
fi
BASE64=$(printf '%s:%s' "$AGROMETINFO_ACTIVEMQ_USER" "$AGROMETINFO_ACTIVEMQ_PASSWORD" | base64)
JSON='{
Loading