Created
November 24, 2019 10:27
-
-
Save alexsoyes/62ae79ee3e6ee5ffa1e5c30b841564b0 to your computer and use it in GitHub Desktop.
Weekly ClamAV scan with CLI
This file contains 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 | |
set -e | |
# @explain this script is run by a cronjob every week | |
### “At 04:00 on Friday.” | |
### 0 4 * * 5 /opt/clamscan.sh > /home/alex/clamav.log 2>&1 | |
# @vars defined | |
MAX_FILE_SIZE=128M # do not check files with size higher | |
DIRECTORY_TO_SCAN=/home/web/html/owncloud/ | |
# @vars global | |
CURRENT_DATE=`date +"%Y_%m_%d-%H_%M_%S"` | |
LOG_DIR="/root/logs/clamav" | |
# @init | |
mkdir -vp "${LOG_DIR}" | |
# @start scan | |
clamscan --suppress-ok-results --recursive --log="${LOG_DIR}/${CURRENT_DATE}.log" --max-filesize=128M "${DIRECTORY_TO_SCAN}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment