OPNsense
  • Home
  • Help
  • Search
  • Login
  • Register

  • OPNsense Forum »
  • English Forums »
  • Development and Code Review (Moderator: fabian) »
  • [SOLVED]adding custom cron job?
« previous next »
  • Print
Pages: [1]

Author Topic: [SOLVED]adding custom cron job?  (Read 27248 times)

Stephan

  • Jr. Member
  • **
  • Posts: 60
  • Karma: 3
    • View Profile
[SOLVED]adding custom cron job?
« on: October 16, 2017, 12:41:51 pm »
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
« Last Edit: October 16, 2017, 02:53:27 pm by Stephan »
Logged

mimugmail

  • Hero Member
  • *****
  • Posts: 6767
  • Karma: 494
    • View Profile
Re: adding custom cron job?
« Reply #1 on: October 16, 2017, 01:47:48 pm »
If I remember correctly the file needs a description to do the magic :)
Logged
WWW: www.routerperformance.net
Support plans: https://www.max-it.de/en/it-services/opnsense/
Commercial Plugins (German): https://opnsense.max-it.de/

Stephan

  • Jr. Member
  • **
  • Posts: 60
  • Karma: 3
    • View Profile
Re: adding custom cron job?
« Reply #2 on: October 16, 2017, 02:03:52 pm »
Hmm, yes - that's what I thought too...
This is the output from configctl:
Code: [Select]
configctl configd actions list|grep squidan
squidanalyzer update [ Update squidanalyzer data ]

and that's the config file:

Code: [Select]
[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...
Logged

Stephan

  • Jr. Member
  • **
  • Posts: 60
  • Karma: 3
    • View Profile
Re: adding custom cron job?
« Reply #3 on: October 16, 2017, 02:23:23 pm »
 meanwhile found this https://forum.opnsense.org/index.php?topic=2263.0 which is exactly what I did...

also did a
Code: [Select]
/usr/local/etc/rc.restart_webgui
Logged

Stephan

  • Jr. Member
  • **
  • Posts: 60
  • Karma: 3
    • View Profile
Re: adding custom cron job?
« Reply #4 on: October 16, 2017, 02:50:19 pm »
ok - sorry for any inconveniences  8)

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

Cheers,

Stephan
Logged

franco

  • Administrator
  • Hero Member
  • *****
  • Posts: 17703
  • Karma: 1616
    • View Profile
Re: [SOLVED]adding custom cron job?
« Reply #5 on: October 16, 2017, 11:47:47 pm »
May be missing:

# service configd restart


Cheers,
Franco
Logged

Stephan

  • Jr. Member
  • **
  • Posts: 60
  • Karma: 3
    • View Profile
Re: [SOLVED]adding custom cron job?
« Reply #6 on: October 17, 2017, 06:43:25 pm »
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
Code: [Select]
configctl configd restart and this?
Logged

franco

  • Administrator
  • Hero Member
  • *****
  • Posts: 17703
  • Karma: 1616
    • View Profile
Re: [SOLVED]adding custom cron job?
« Reply #7 on: October 17, 2017, 06:48:42 pm »
Not really. The former uses the FreeBSD facility, the latter lets the daemon do the restart itself.
Logged

thefunkygibbon

  • Jr. Member
  • **
  • Posts: 81
  • Karma: 2
    • View Profile
Re: [SOLVED]adding custom cron job?
« Reply #8 on: March 08, 2022, 03:59:40 pm »
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?
Logged

franco

  • Administrator
  • Hero Member
  • *****
  • Posts: 17703
  • Karma: 1616
    • View Profile
Re: [SOLVED]adding custom cron job?
« Reply #9 on: March 10, 2022, 01:51:02 pm »
Do not edit existing files...they are operated by firmware updates... create your own file.


Cheers,
Franco
Logged

  • Print
Pages: [1]
« previous next »
  • OPNsense Forum »
  • English Forums »
  • Development and Code Review (Moderator: fabian) »
  • [SOLVED]adding custom cron job?
 

OPNsense is an OSS project © Deciso B.V. 2015 - 2024 All rights reserved
  • SMF 2.0.19 | SMF © 2021, Simple Machines
    Privacy Policy
    | XHTML | RSS | WAP2