Skip to content

Instantly share code, notes, and snippets.

@philipp-r
Created May 26, 2020 17:12
Show Gist options
  • Save philipp-r/3df4f45490bd0e8f803abff1aa651e45 to your computer and use it in GitHub Desktop.
Save philipp-r/3df4f45490bd0e8f803abff1aa651e45 to your computer and use it in GitHub Desktop.
ClamAV Scanner Script
#!/bin/bash
clamscan -i -r $1 > clamlog.txt 2>&1
clamstatus=$?
clamlog=$(<clamlog.txt)
#echo "$clamlog"
if [ $clamstatus == 2 ]; then
clamstatustext="ERROR"
echo "$clamlog scanned $1" | mailx -s "ClamAV $clamstatustext on 123.456.0.0" [email protected]
elif [ $clamstatus == 1 ]; then
clamstatustext="VIRUS"
echo "$clamlog scanned $1" | mailx -s "ClamAV $clamstatustext on 123.456.0.0" [email protected]
else
clamstatustext="clean"
fi
rm clamlog.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment