How to make a CronJob on the 12th every month (permanently)

How can I make a cronjob for UNBOUND to download “r00t” hints every month on the 12th?

This cronjob for UNBOUND should be stored permanently.

/usr/bin/curl -v -o /var/lib/unbound/secret.hints https://www.internic.net/domain/named.cache

read about crontab -e
0 0 12 0 0 (12th day of every month)

thanks for that! :slight_smile: :slight_smile:

I want: on every 12th day on every month at 6:30 pm.

How to add permanently? in /etc/crontab?

sure, do it as root.

done, but the “cronjob” I’ve set won’t execute.

…I’ve done:

sudo su

cronjob -e

put in:
59 18 7 * * root /usr/bin/curl -v -o /var/lib/unbound/root.hints https://www.internic.net/domain/named.cache

18:59 should be in pm format (german time).

or is that right?
59 6 7 * *

6pm… (18)

today is 7th.

I’ve tested it and my command is not executed.

When I run it alone, then it works.

service cron status = running

cron uses 24 hour (0-23) format.

As root, I edited the system-wide /etc/crontab, I added the 5th line: (make sure the last line is #) I asked it to run on the 7th day of the month, at 13:40 see output of syslog. Also see file it created.

40 13 7 * * root curl -o /var/lib/unbound/root.hints https://www.internic.net/domain/named.cache

output from /var/log/syslog

Nov  7 13:40:01 bionic CRON[26232]: (root) CMD (   curl -o /var/lib/unbound/root.hints https://www.internic.net/domain/named.cache)
Nov  7 13:40:03 bionic CRON[26231]: (CRON) info (No MTA installed, discarding output)

ls -l /var/lib/unbound/

-rw-r--r-- 1 root root 3315 Nov 7 13:40 root.hints

HTH

what do you mean with I added the 5th line: (make sure the last line is #) I asked it to run on the 7th day of the month, at 13:40 see output of syslog. Also see file it created?

(make sure the last line is #) ?

40 13 7 * * root curl -o /var/lib/unbound/root.hints https://www.internic.net/domain/named.cache
#?

crontab requires the last line of the /etc/crontab to be a blank line (I added the pound symbol).

ok, thanks, now its working :slight_smile: