Hello,
I am trying to make weekly cron job to scan new files in "home3/*/mail" and "home5/*/mail" folders and to remove them if infected, but only for last 7 days of new files.
Currently I have this working pretty good, but it takes too long for it to finish because it scans all files in mail folders:
/usr/local/cpanel/3rdparty/bin/clamscan -ir --remove /home4/*/mail/ /home5/*/mail/ | mail -s "Finished weekly scan and deletion of emails in folder mail" [email protected]
I would like to scan only new files and make it run once a week, and maybe daily in future.
Currenty it scans directories: 40966 and files: 3076744. I would like to speed things up and make it use less resources.
Does anybody know how can I achieve this?
I have found this, but not tested:
find /home4/*/mail/ /home5/*/mail/ -ctime -1 -type f -print0 | xargs -0 /usr/local/cpanel/3rdparty/bin/clamscan --remove mail -s "Finished weekly scan and deletion of emails in folder mail" [email protected]
I am trying to make weekly cron job to scan new files in "home3/*/mail" and "home5/*/mail" folders and to remove them if infected, but only for last 7 days of new files.
Currently I have this working pretty good, but it takes too long for it to finish because it scans all files in mail folders:
/usr/local/cpanel/3rdparty/bin/clamscan -ir --remove /home4/*/mail/ /home5/*/mail/ | mail -s "Finished weekly scan and deletion of emails in folder mail" [email protected]
I would like to scan only new files and make it run once a week, and maybe daily in future.
Currenty it scans directories: 40966 and files: 3076744. I would like to speed things up and make it use less resources.
Does anybody know how can I achieve this?
I have found this, but not tested:
find /home4/*/mail/ /home5/*/mail/ -ctime -1 -type f -print0 | xargs -0 /usr/local/cpanel/3rdparty/bin/clamscan --remove mail -s "Finished weekly scan and deletion of emails in folder mail" [email protected]
Last edited by a moderator: