Cron Job
I want to configure a cron job for ClamV to run at say 5am.
I understand that I might need to modify /var/spool/cron/root, and I found the following command in the help pages.
Is it just a matter of dropping the time schedule in front of this, so:
or is it more complex ??
for i in `awk '!/nobody/{print $2 | "sort | uniq" }' /etc/userdomains | sort | uniq`; do /usr/local/cpanel/3rdparty/bin/clamscan -i -r /home/$i 2>>/dev/null; done >> /root/infections&
Is it just a matter of dropping the time schedule in front of this, so:
0 5 * * * for i in `awk '!/nobody/{print $2 | "sort | uniq" }' /etc/userdomains | sort | uniq`; do /usr/local/cpanel/3rdparty/bin/clamscan -i -r /home/$i 2>>/dev/null; done >> /root/infections&
or is it more complex ??
-
Just to be more organized, make a file let's say it's name will be "virscan" and put this in it: #!/bin/bash for i in `awk '!/nobody/{print $2 | "sort | uniq" }' /etc/userdomains | sort | uniq`; do /usr/local/cpanel/3rdparty/bin/clamscan -i -r /home/$i 2>>/dev/null; done >> /root/infections&
Make it executable:chmod 755 virscan
Move it to let's say "/usr/local/bin" then add this line in Cron:0 5 * * * /bin/bash /usr/local/bin/virscan
BTW, you can reach cron by this command:crontab -e0 -
Hello :) Yes, the previous post is accurate, and you should edit the root cron with the "crontab -e" command as mentioned. Thank you. 0 -
I looked at crontab -e yesterday, and thought it looked a bit fiddly. Is it not easier to modify the file using CS Explorer ? I'm away from the office for a few weeks after today, so i'll look at implimenting this when i get back (just in case something breaks) Thanks 0 -
You can edit the file manually if you prefer. The "e" flag opens it with the default text editor as defined in your bash profile. Thank you. 0
Please sign in to leave a comment.
Comments
4 comments