OPNsense Forum

English Forums => 25.7, 25.10 Series => Topic started by: JustMeHere on January 06, 2026, 06:38:08 PM

Title: Updating URL table Alias lists with either a cron entry or an API call?
Post by: JustMeHere on January 06, 2026, 06:38:08 PM
Can we do Cron style updates for URL Tables in Aliases? The idea is that I'd like to update the list every 6 hours with a random 15 minutes...then have the URL Tables refresh on the 16th minute.  Or even better, is there a way to trigger an update via API call?
Title: Re: Updating URL table Alias lists with either a cron entry or an API call?
Post by: pfry on January 06, 2026, 11:21:52 PM
I'm missing how this is different from the refresh interval. Or are you just looking to vary the timing a bit? (Boredom?)
Title: Re: Updating URL table Alias lists with either a cron entry or an API call?
Post by: JustMeHere on January 07, 2026, 04:13:24 PM
Because the refresh interval is only hours and minutes...ex:  1 day and 8 hours means the alias will be refreshed after 32 hours.  This time floats too.  It's going to be 32 hours from now.  If the server reboots the "from now" changes.

But if I have cron job, I can schedule the refresh at a specific time:

Use case:  my black list is published at 00:00, 06:00, 12:00, and 18:00

First set a cron job to do this:
05~30 */6 * * * *  update_blacklish.shThis will wait between 5 and 30 minutes after the list is published and download it to my staging server.

The cron job on Opnsense will be
35 */6 * * * * <refresh url table>This will update the URL Table alias list at 00:35, 06:35, 12:35 and 18:35.

Using cron jobs allow the updates/refreshes to
1) try not to cram the black list server but still get the list in a reasonable amount of time after update.
2) only use up CPU reprocessing the list on the firewall when there is a known update.

Even better would be able to trigger step 2 via an API call.  Then the list is only updated when the process in step 1 knows it got a new list.  (The second cron job wouldn't be needed.)
Title: Re: Updating URL table Alias lists with either a cron entry or an API call?
Post by: pfry on January 07, 2026, 04:38:18 PM
Quote from: JustMeHere on January 07, 2026, 04:13:24 PM[...]Use case:  my black list is published at 00:00, 06:00, 12:00, and 18:00[...]

Ah, got it, thanks. If all else fails, since you have the data staged, you could set a short update interval on the firewall. But I can see where fixed timing and/or triggered updates would have advantages with few disadvantages.