Sadece public_html altındaki dosyaları tarama ve sonuçları mail atma.
public_scan.sh içeriği
[sourcecode language=”powershell”]
#!/bin/bash
echo “hesaplar taraniyor…”
for i in `awk ‘!/nobody/{print $2 | “sort | uniq” }’ /etc/userdomains | sort | uniq`;
do
if [ ! -d “/home/$i” ]; then
/usr/bin/clamscan -i -r –no-summary /home/$i/public_html 2>>/dev/null;
fi;
done;
NOW=$(date +\%Y\%m\%d)
# script to send simple email
# email subject
SUBJECT=”antivirus tarama bitti”
# Email To ?
EMAIL=”email”
# Email text/message
EMAILMESSAGE=”/root/clamAntivirus_shell/infections_$NOW.log”
#echo “This is an email message test” > $EMAILMESSAGE
#echo “This is email text” >> $EMAILMESSAGE
# send an email using /bin/mail
/bin/mail -s “$SUBJECT” “$EMAIL” < $EMAILMESSAGE
[/sourcecode]
Her gece tarama ve sonuçları log dosyasına yazdırma.
[sourcecode language="powershell"]
7 0 * * * sh /root/public_scan.sh >> /root/infections_$(date +\%Y\%m\%d).log 2>&1
[/sourcecode]