#!/bin/bash
#
# Doing some stuff for zephir start
# don't ask why !
#
ZEPHIR_DIR=/usr/share/zephir
TEMPLATE_DIR=${ZEPHIR_DIR}/monitor/agentmanager/templates
# si les nouveaux agents sont installés,
# on recompile les templates Cheetah
if [ -d $TEMPLATE_DIR ]
then
    echo "#######################################"
    echo "# Recompilation des templates cheetah #"
    echo "#######################################"
        cd $TEMPLATE_DIR
        make # >/dev/null
        cd $ZEPHIR_DIR
fi
# on recopie les données statiques si nécessaire
if [ ! -f /var/lib/zephir/sites/stylesheet.css ]
then
    cp -rf ${ZEPHIR_DIR}/monitor/static/*.css /var/lib/zephir/sites/
fi
# images
unset echo
cp -rf ${ZEPHIR_DIR}/monitor/static/img /var/lib/zephir/sites/
python3 /usr/share/zephir/utils/parse_logs.py
