Skip to content

Commit

Permalink
Merge pull request #453 from m-1-k-3/cronjob
Browse files Browse the repository at this point in the history
cron job fix
  • Loading branch information
m-1-k-3 authored Jan 13, 2023
2 parents a019263 + b9a1ae1 commit ca6efac
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions config/emba_updater.init
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit ca6efac

Please sign in to comment.