diff --git a/smartgears/dataminer_app/templates/algorithms-updater.j2 b/smartgears/dataminer_app/templates/algorithms-updater.j2 index 35e05716..1c1099f4 100644 --- a/smartgears/dataminer_app/templates/algorithms-updater.j2 +++ b/smartgears/dataminer_app/templates/algorithms-updater.j2 @@ -22,6 +22,7 @@ trap "logger 'algorithms-updater: trap intercepted, exiting.' ; cleanup 1" SIGHU function cleanup() { rm -fr $OUT_DIR rm -f $LOCK_FILE + logger 'algorithms-updater: Exiting' exit $1 } @@ -103,15 +104,19 @@ function algorithms_updater() { done < ${ALGORITHMS_TEMP_SCRIPT}.algorithmslist set -o pipefail set -e - mv $ALGORITHMS_TEMP_SCRIPT.body_ $ALGORITHMS_TEMP_SCRIPT.body - cat $ALGORITHMS_TEMP_SCRIPT.head $ALGORITHMS_TEMP_SCRIPT.body > $ALGORITHMS_TEMP_SCRIPT - chmod 755 $ALGORITHMS_TEMP_SCRIPT - if [ -x $ADD_ALGORITHM_PATH ] ; then - logger 'algorithms-updater: add the algorithms configurations. Reference infra is {{ dataminer_infra_reference }}' - $ALGORITHMS_TEMP_SCRIPT >> $LOG_FILE 2>&1 + if [ -f $ALGORITHMS_TEMP_SCRIPT.body_ ] ; then + mv $ALGORITHMS_TEMP_SCRIPT.body_ $ALGORITHMS_TEMP_SCRIPT.body + cat $ALGORITHMS_TEMP_SCRIPT.head $ALGORITHMS_TEMP_SCRIPT.body > $ALGORITHMS_TEMP_SCRIPT + chmod 755 $ALGORITHMS_TEMP_SCRIPT + if [ -x $ADD_ALGORITHM_PATH ] ; then + logger 'algorithms-updater: add the algorithms configurations. Reference infra is {{ dataminer_infra_reference }}' + $ALGORITHMS_TEMP_SCRIPT >> $LOG_FILE 2>&1 + else + logger 'algorithms-updater: {{ smartgears_user_home }}/algorithmInstaller/addAlgorithm.sh is not an executable, aborting' + cleanup 1 + fi else - logger 'algorithms-updater: {{ smartgears_user_home }}/algorithmInstaller/addAlgorithm.sh is not an executable, aborting' - cleanup 1 + cleanup 0 fi }