Hi,
i would like to know ho i can set an sendmail client to use my smtp client i set up ober the proxmox gui in a script like:
all i´ve tried failed so far. For freshclam i get a notification without setting anything. So i guess there must be an easy way to set this as well for clamscan, maybe without a script. So if anybody know how to automate clamscan with getting an e-mail with the results would be lovely.
i would like to know ho i can set an sendmail client to use my smtp client i set up ober the proxmox gui in a script like:
Code:
#!/bin/bash
# Protokolldatei mit Tageszeitstempel
LOGFILE="/var/log/clamav/clamav-$(date +'%Y-%m-%d').log"
# E-Mail-Konfigurationsdetails
EMAIL_MSG="Bitte beachten Sie die beigefügte Protokolldatei."
#EMAIL_FROM=
#EMAIL_TO=
# Gesamtes System scannen
DIRTOSCAN="/"
# Verzeichnisse ausschließen (Regex für --exclude-dir)
EXCLUDE_DIRS="^/proc|^/sys|^/dev|^/run|^/tmp"
# Scan starten
echo "Starte einen vollständigen Scan des Systems. Ergebnisse werden in $LOGFILE gespeichert."
# Führe clamscan aus und protokolliere
clamscan -ri "$DIRTOSCAN" --exclude-dir="$EXCLUDE_DIRS" >> "$LOGFILE"
# Überprüfe auf Malware
MALWARE=$(tail "$LOGFILE" | grep Infected | cut -d" " -f3)
if [ "$MALWARE" -ne "0" ]; thenecho "$EMAIL_MSG"|mail -a "$LOGFILE" -s "ClamAV: Malware Found" -r "$EMAIL_FROM" "$EMAIL_TO";
fi
exit 0
all i´ve tried failed so far. For freshclam i get a notification without setting anything. So i guess there must be an easy way to set this as well for clamscan, maybe without a script. So if anybody know how to automate clamscan with getting an e-mail with the results would be lovely.
Last edited: