diff --git a/smartgears/dataminer_app/templates/algorithms-updater.j2 b/smartgears/dataminer_app/templates/algorithms-updater.j2 index a5c3006c..7dd29a28 100644 --- a/smartgears/dataminer_app/templates/algorithms-updater.j2 +++ b/smartgears/dataminer_app/templates/algorithms-updater.j2 @@ -208,18 +208,20 @@ update_svn_repo() { create_log_dir check_lock_file update_svn_repo -SVN_ALGORITHMS_NUM=$( wc -l "$ALGORITHMS_FILE" | awk '{print $1}' ) -INSTALLED_ALGORITHMS_NUM=$( wc -l "$ALGORITHMS_INSTALLED_FILE" | awk '{print $1}' ) if [ $SVN_UPDATE_STATUS -ne 0 ] ; then if [ -d "${LOG_DIR}" ] ; then - if [ ! -f "$ALGORITHMS_INSTALLED_FILE" ] || [ ! -s "$ALGORITHMS_INSTALLED_FILE" ] ; then - logger "algorithms-updater: nothing new to from SVN but the file that lists the installed algorithms does not exist or is empty. We are going to reinstall all the algorithms." - elif [ $SVN_ALGORITHMS_NUM -gt $INSTALLED_ALGORITHMS_NUM ] ; then - logger "algorithms-updater: nothing new to from SVN but the installed algorithms are less than the expected number. We are going to run the installer." + if [ -f "$ALGORITHMS_INSTALLED_FILE" ] ; then + SVN_ALGORITHMS_NUM=$( wc -l "$ALGORITHMS_FILE" | awk '{print $1}' ) + INSTALLED_ALGORITHMS_NUM=$( wc -l "$ALGORITHMS_INSTALLED_FILE" | awk '{print $1}' ) + if [ $SVN_ALGORITHMS_NUM -gt $INSTALLED_ALGORITHMS_NUM ] ; then + logger "algorithms-updater: nothing new from SVN but the installed algorithms are less than the expected number. We are going to run the installer." + else + logger "algorithms-updater: nothing new from SVN and all the algorithms are installed, exiting." + cleanup 0 + fi else - logger "algorithms-updater: nothing new to from SVN and all the algorithms are installed, exiting." - cleanup 0 - fi + logger "algorithms-updater: nothing new from SVN but the file that lists the installed algorithms does not exist. We are going to reinstall all the algorithms." + fi fi fi sort_installed_algo_file