processone / ejabberd-contrib

Growing and curated ejabberd contributions repository - PR or ask to join !

Home Page:http://ejabberd.im

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

mod_cron: ctl "function" needs argument, even if empty

sando38 opened this issue · comments

Refering to the changes from #307 , it may be notable, that once I run a ctl command like

mod_cron: 
    tasks:
      - time: 1
        units: days
        ctl: delete_expired_pubsub_items
        arguments:
          - ""

without the arguments section, the module fails to load/ start. The example below does not work:

mod_cron: 
    tasks:
      - time: 1
        units: days
        ctl: delete_expired_pubsub_items
#        arguments:
#         - ""

One more thing, when I use the following config:

    # purge expired offline messages
      - time: 12
        units: hours
        ctl: delete_expired_messages
        arguments:
          - ""

I recieve the following error:

Error: the command 'delete_expired_messages' requires 1 less argument.
  Command Name: delete_expired_messages

  Arguments: 

  Returns: res::rescode

  Tags: purge

  Module: unknown

  Description: Delete expired offline messages from database

Error: the command 'delete_expired_messages' requires 1 less argument.

If I put away the argument, the module fails to start as said in the initial post.

        arguments:
          - ""

Umm, no, this should be:

        arguments: []

I've added this explanation to the README.

without the arguments section, the module fails to load/ start.

Ok, I've fixed that, now it works.

ahh.. thanks for the hint with the brackets []
Yes. It works as said. And good idea to create a default value.

As mentioned in the other issue, it might be a good idea to include the module as a "core" module into the ejabberd package, since with the ctl commands, it can help administrators to schedule some maintenance tasks in an easy going way.