Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Clamav autoscan + Email alert
#!/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
You can’t perform that action at this time.