Created
May 13, 2019 19:27
-
-
Save healeyio/4e0d056ab9ce0b4d8aad519a5078d2e2 to your computer and use it in GitHub Desktop.
OpenVAS Update Script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Only update OpenVAS when no scans are running | |
scanRunning="$(ps aux | grep "openvassd: testing " | wc -l)" | |
scanRunning=$((scanRunning + "$(ps aux | grep "openvasmd: OTP: Handling scan" | wc -l)")) | |
# if the commands above result in 2 or less, a scan is not running and it is safe to update | |
if [ $scanRunning -le 2 ]; then | |
echo "Updating OpenVas Feeds" | |
/usr/sbin/greenbone-nvt-sync | |
/usr/sbin/greenbone-certdata-sync | |
/usr/sbin/greenbone-scapdata-sync | |
/usr/sbin/openvasmd --update --verbose --progress | |
/bin/systemctl restart openvas-scanner | |
/bin/systemctl restart openvas-manager | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment