diff --git a/config/emba_updater.init b/config/emba_updater.init index 8018f7a12..a0737fa4f 100644 --- a/config/emba_updater.init +++ b/config/emba_updater.init @@ -3,29 +3,34 @@ # Written by Michael Messner and Pascal Eckmann for EMBA https://github.com/e-m-b-a/emba BASE_PATH="$(pwd)" +LOG_DIR="/var/log" +[ -d EMBA_INSTALL_PATH ] || exit 0 +[ -d EMBA_INSTALL_PATH/external/trickest-cve ] || exit 0 [ -x EMBA_INSTALL_PATH/external/cve-search/sbin/db_updater.py ] || exit 0 [ -x /etc/init.d/redis-server ] || exit 0 +[ -d "$LOG_DIR" ] || exit 0 if command -v cve_searchsploit > /dev/null ; then - echo "[*] EMBA update - cve_searchsploit update" | tee -a /var/log/emba_update.log - cve_searchsploit -u | tee -a /var/log/emba_update.log + echo "[*] EMBA update - cve_searchsploit update" | tee -a "$LOG_DIR"/emba_update.log + cve_searchsploit -u | tee -a "$LOG_DIR"/emba_update.log fi -echo "[*] EMBA update - main repository" | tee -a /var/log/emba_update.log +echo "[*] EMBA update - main repository" | tee -a "$LOG_DIR"/emba_update.log cd EMBA_INSTALL_PATH || exit -git pull | tee -a /var/log/emba_update.log +git pull | tee -a "$LOG_DIR"/emba_update.log cd "$BASE_PATH" || exit -echo "[*] EMBA update - cve-search update" | tee -a /var/log/emba_update.log -/etc/init.d/redis-server start | tee -a /var/log/emba_update.log +echo "[*] EMBA update - cve-search update" | tee -a "$LOG_DIR"/emba_update.log +service mongod start | tee -a "$LOG_DIR"/emba_update.log +/etc/init.d/redis-server start | tee -a "$LOG_DIR"/emba_update.log -EMBA_INSTALL_PATH/external/cve-search/sbin/db_updater.py -v | tee -a /var/log/emba_update.log +EMBA_INSTALL_PATH/external/cve-search/sbin/db_updater.py -v | tee -a "$LOG_DIR"/emba_update.log -echo "[*] EMBA update - update local trickest database" | tee -a /var/log/emba_update.log +echo "[*] EMBA update - update local trickest database" | tee -a "$LOG_DIR"/emba_update.log cd EMBA_INSTALL_PATH/external/trickest-cve || exit -git pull | tee -a /var/log/emba_update.log +git pull | tee -a "$LOG_DIR"/emba_update.log cd "$BASE_PATH" || exit -echo "[*] EMBA update - update local docker image" | tee -a /var/log/emba_update.log -docker pull embeddedanalyzer/emba | tee -a /var/log/emba_update.log +echo "[*] EMBA update - update local docker image" | tee -a "$LOG_DIR"/emba_update.log +docker pull embeddedanalyzer/emba | tee -a "$LOG_DIR"/emba_update.log