opnSense Cron Jobs

Basically, it uses configd, so you have to create a service definition for your new script.

cd /usr/local/opnsense/service/conf/actions.d

Create a file with the name actions_NAME.conf, where NAME is something meaningful to you. The file should have a basic win ini format, with the action needed, then a bunch of lines describing what to do.

Example of a file named actions_updatedns.conf:

[reload]
command:/root/updateDNS
parameter:
type:script
message:update Daily Data DNS
description:Update Daily Data DNS

Now that you have added a new config, you need to reload configd so it will read it:

service configd restart

And, test that you did everything right

configctl updatedns reload

the script /root/updateDNS will be run. You can create multiple actions (stop,start) in the same file with different scripts and/or parameters.

Once this is done, the string after message (or description, I don't know which) will show up as a possible cron job in the opnSense GUI

The log files are stored in /var/log/configd.log

Bibliography