Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Weekly ClamAV scan with CLI
#!/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
You can’t perform that action at this time.