Last active
October 28, 2015 15:17
-
-
Save MattLoyeD/3d981613d14020fa2ffa to your computer and use it in GitHub Desktop.
Clamav autoscan + Email alert
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 | |
# Usage "sh script.sh /path/to/check" | |
if [ -z "$1" ]; then | |
vir_dir="`./virus`" | |
else | |
vir_dir="$1" | |
fi | |
mails=mail@domain.tld; | |
subject="Virus sur le serveur !"; | |
sudo freshclam; | |
sudo clamscan -r --move=${vir_dir} /; | |
v="$(ls ${vir_dir})"; | |
if [ ${#v} -ge 1 ]; | |
then echo ${v} | mail -s "${subject}" ${mails}; exit | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment