[SOLVED]adding custom cron job?

Started by Stephan, October 16, 2017, 12:41:51 PM

Previous topic - Next topic
October 16, 2017, 12:41:51 PM Last Edit: October 16, 2017, 02:53:27 PM by Stephan
Hi there,

I tried to add a custom cron job by adding a conf file to /usr/local/opnsense/service/conf/actions.d/ and tested it successfully with configctl.

Now I wonder whats the magic that this command shows up in the command list in the web interface (settings/cron)?

Thanx,

Stephan

[EDIT]: After restarting all services it worked - the question remains: which service reloads the item list?
a quick guide how to create individual cron jobs can be found here https://forum.opnsense.org/index.php?topic=2263.0

If I remember correctly the file needs a description to do the magic :)

Hmm, yes - that's what I thought too...
This is the output from configctl:
configctl configd actions list|grep squidan
squidanalyzer update [ Update squidanalyzer data ]


and that's the config file:

[update]
command:/usr/local/bin/squid-analyzer
parameter:
type:script
message:Updating squidanalyzer data
description:Update squidanalyzer data


They discussed it here https://forum.opnsense.org/index.php?topic=1936.0 for a module - and iosense wrote somth about a 'typo' though I can't see anything wrong in his code above...

 meanwhile found this https://forum.opnsense.org/index.php?topic=2263.0 which is exactly what I did...

also did a /usr/local/etc/rc.restart_webgui

ok - sorry for any inconveniences  8)

after a restart of the service it showed up in the list!  ;)

Cheers,

Stephan

May be missing:

# service configd restart


Cheers,
Franco

Quote from: franco on October 16, 2017, 11:47:47 PM
May be missing:

# service configd restart


Cheers,
Franco
hmm - is there a difference between configctl configd restart and this?

Not really. The former uses the FreeBSD facility, the latter lets the daemon do the restart itself.

i have edited one of the "action...." files and added a command to run a script.  which was working.  but this file just got overwritten by a opnsense system update (just a minor one).   how can we go about making these changes survive such an update?

Do not edit existing files...they are operated by firmware updates... create your own file.


Cheers,
Franco