Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

Commit 781ea8b1 authored by Antoine Blanquet's avatar Antoine Blanquet
Browse files

handle error of installation of phantomjs

parent f24a78af
......@@ -20,7 +20,7 @@ DATA_ORG_FOLDER="data/organizations/"
DATA_APP_FOLDER="data/applications/"
DATA_GAT_FOLDER="data/gateways/"
DATA_DEV_FOLDER="data/devices/"
DATA_IMAGES_FOLDER="data/images/"
rm -f ${DATA_CONFIG_FOLDER}*.token.json
......@@ -31,3 +31,6 @@ rm -f ${DATA_GAT_FOLDER}.gateway-*
rm -f ${DATA_DEV_FOLDER}.devices.*
rm -f ${DATA_DEV_FOLDER}.application*
rm -f ${DATA_APP_FOLDER}.organization*
rm -f ${DATA_APP_FOLDER}.organization*
rm -f ${DATA_IMAGES_FOLDER}sparkline_report.png
......@@ -88,5 +88,12 @@ echo "Passive Active Check"
./get_id_gateways_change.sh ".gateways.html"
./get_id_gateways_change.sh ".gateways_without_sparkline.html"
# Generate an image of the page html with sparkline
node generate_sparkline_image.js
\ No newline at end of file
# Installation
if ! [ -x "$(command -v phantomjs)" ]; then
echo "Missings libs to generate sparkline as a png image. Check out README.md of reports"
echo "We are skipping the generation of the picture."
else
# Generate an image of the page html with sparkline
node generate_sparkline_image.js
fi
......@@ -34,29 +34,34 @@ CONTENT_TYPE_IMG="Content-type: image/png"
ATTACHMENT="../images/operators.png"
mail -a "$CONTENT_TYPE_HTML" -s "$SUBJECT" -u monitoring $TO < ${devices_html}
# mail -a "$CONTENT_TYPE" -s "$SUBJECT" -u monitoring $TO <${gateways_without_spark_html} #générée avec pièce jointe dorénavant. (voir ci-dessous)
IMAGE="sparkline_report.png"
IMAGE_LOC="${DATA_IMAGES_FOLDER}${IMAGE}"
outputFile="${gateways_without_spark_html}"
(
echo "To: $TO"
echo "Subject: $SUBJECT"
echo "Mime-Version: 1.0"
echo "$CONTENT_TYPE_MUL"
echo "Content-Disposition: inline"
echo ""
echo "--GvXjxJ+pjyke8COw"
echo "$CONTENT_TYPE_HTML"
echo "Content-Disposition: inline"
cat $outputFile
echo ""
echo "--GvXjxJ+pjyke8COw"
echo "$CONTENT_TYPE_IMG"
echo "Content-Transfer-Encoding: BASE64"
echo "Content-ID: <envoie sparkline>"
echo "Content-Disposition: attachement; filename=${IMAGE}"
echo ""
cat $IMAGE_LOC | base64
) | mail -t
\ No newline at end of file
if ! [ -f "${devices_html}" ]; then
# if there was a problem during the installation of npm when generating the screenshot, we generate gateways email without the attachment.
mail -a "$CONTENT_TYPE" -s "$SUBJECT" -u monitoring $TO <${gateways_without_spark_html}
else
# we generate email gateways with an attachment.
IMAGE="sparkline_report.png"
IMAGE_LOC="${DATA_IMAGES_FOLDER}${IMAGE}"
outputFile="${gateways_without_spark_html}"
(
echo "To: $TO"
echo "Subject: $SUBJECT"
echo "Mime-Version: 1.0"
echo "$CONTENT_TYPE_MUL"
echo "Content-Disposition: inline"
echo ""
echo "--GvXjxJ+pjyke8COw"
echo "$CONTENT_TYPE_HTML"
echo "Content-Disposition: inline"
cat $outputFile
echo ""
echo "--GvXjxJ+pjyke8COw"
echo "$CONTENT_TYPE_IMG"
echo "Content-Transfer-Encoding: BASE64"
echo "Content-ID: <envoie sparkline>"
echo "Content-Disposition: attachement; filename=${IMAGE}"
echo ""
cat $IMAGE_LOC | base64
) | mail -t
fi
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment