使用 Ubuntu 16。我在cron.daily文件夹中有以下脚本。但是,我通过电子邮件通知收到错误消息:
/etc/cron.daily/clamscan_daily:
run-parts: failed to exec /etc/cron.daily/clamscan_daily: Exec format error
run-parts: /etc/cron.daily/clamscan_daily exited with return code 1
Run Code Online (Sandbox Code Playgroud)
脚本
#!/bin/bash
LOGFILE="/var/log/clamav/clamav-$(date +'%Y-%m-%d').log";
EMAIL_MSG="Please see the log file attached.";
EMAIL_FROM="no-reply@domain.com";
EMAIL_TO="admin@domain.com";
DIRTOSCAN="/var/www";
for S in ${DIRTOSCAN}; do
DIRSIZE=$(du -sh "$S" 2>/dev/null | cut -f1);
echo "Starting a daily scan of "$S" directory.
Amount of data to be scanned is "$DIRSIZE".";
clamscan -ri "$S" >> "$LOGFILE";
# get the value of "Infected lines"
MALWARE=$(tail "$LOGFILE"|grep Infected|cut -d" " -f3); …Run Code Online (Sandbox Code Playgroud)