Cisco-Talos / cvdupdate

ClamAV Private Database Mirror Updater Tool
Apache License 2.0
93 stars 35 forks source link

Any cron examples (linux) ? #11

Closed sysdevzero closed 3 years ago

sysdevzero commented 3 years ago

Hello, The script is helpful, just that how to automate this like to run it on an OS level cron? since it has to run on user privilege

Does [ crontab -e ] command like this will work?

20 10 * {username} cvd update >> ~/var/log/clamav/definitions-update/cvd-update.log 2>&1

micahsnyder commented 3 years ago

Hi! What you could do is something like this as the user which you want cvdupdate to run as:

crontab -e

Add this line:

30 */4 * * * /bin/sh -c "~/.local/bin/cvd update &> /dev/null"

I selected 30 */4 * * * to run at minute 30 past every 4th hour. cvdupdate uses a DNS check to do version checks before it attempts to download any files, just like FreshClam. Running cvdupdate more than once a day should not be an issue.

cvdupdate will write logs to the ~/.cvdupdate/logs directory, which is why I directed stdout and stderr to /dev/null instead of a log file. You can use the cvd config set command to customize the log directory if you like, or redirect stdout and stderr to a log file if you prefer everything in one log instead of separate daily logs.

sysdevzero commented 3 years ago

Hi Alright, thank you 👍 This is helpful for me and others to setup the daily cron

micahsnyder commented 3 years ago

Great! I'll close this ticket after I find time to add this info to the Readme.

sysdevzero commented 3 years ago

If others want to try this crontab -e command it works too. please replace username with your linux username.

30 */4 * * * /bin/sh -c "/home/username/.local/bin/cvd update &> /dev/null"