Adding custom CRON jobs

Started by thefunkygibbon, March 15, 2022, 05:23:07 PM

Previous topic - Next topic
Hi,

I need to run a specific script on a schedule.  From what I can make out from the documentation i need to add a custom actions_somethingoranother.conf file to /usr/local/opnsense/service/conf/actions.d

I have done so and I now see the item I created within the dropdown list in the CRON section of the GUI.
But I am getting a error 127 in the logs when it tries to run the cron on its schedule.

I've tried a couple of locations to put the actual script file, and afaik it as the same permissions and ownership as other script files which are ran currently by cron.

content of my actions_custom.conf are


[vpnsquidinterface]
command:/usr/local/opnsense/scripts/proxy/vpnscript.sh
parameters:
type:script
message: reload proxy with vpn interface
description: VPN Proxy script


I've tried to work out https://docs.opnsense.org/development/backend/configd.html but I'm still not hugely clear on if/why it needs a 'name' in the [] brackets at the top. 

error i get is
2022-03-15T16:21:00 Informational configd.py message f66b3eb5-d5e3-47cf-a595-3565daeca9ce [custom.vpnsquidinterface] returned Error (127)
2022-03-15T16:21:00 Error configd.py [f66b3eb5-d5e3-47cf-a595-3565daeca9ce] returned exit status 127
2022-03-15T16:21:00 Notice configd.py [f66b3eb5-d5e3-47cf-a595-3565daeca9ce] reload proxy with vpn interface

which as far as i can tell , means that the file isn't found.   the file is there, and as I say, its got correct ownership/permissions and i've tried a few places and get the same sort of error.  despite following the same convention as existing cron actions. 

thanks in advance