Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cron job fix #453

Merged
merged 1 commit into from
Jan 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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