Skip to content

Instantly share code, notes, and snippets.

@MattLoyeD
Last active October 28, 2015 15:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MattLoyeD/3d981613d14020fa2ffa to your computer and use it in GitHub Desktop.
Save MattLoyeD/3d981613d14020fa2ffa to your computer and use it in GitHub Desktop.
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