mod_cron - Execute scheduled commands

Name: mod_cron
Purpose: Execute scheduled commands
Author: Badlop
Type: Module
Requirements: ejabberd 1.1.x
Download:

Links

  • This program implements a similar concept in erlang: cron.erl

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Specifying a Host?

Is there a way to specify running a cron for a specific Host? If you currently setup a cron it runs the same function on all Hosts.

Jeffrey R. | dS

Use webadmin, or ejabberd svn, or apply a patch

Currently, you set a task this way:

{modules, [
  ...
  {mod_cron, [{tasks, [
    {3, hours, mnesia, info, []}
  ]}]},
  ...
]}.

This starts a mod_cron in each vhost, and configures all them with the same options. This means each vhost will run this task.

To enable a module only in a vhost, or to have different configurations for each vhost, you need to use the webadmin.

A feature was recently included in ejabberd svn which allows to define per-vhost modules: Config file: add a way to append values to config options. So, if you use a recent version of ejabberd SVN, you can enable mod_cron only in a vhost, and only this one will run the task. To do that, use only this configuration:

{host_config, "two.example.org", [
  {modules, [
    {mod_cron, [{tasks, [
      {3, hours, mnesia, info, []}
    ]}]}
  ]}
]}.

If you don't want to update to ejabberd SVN, you can find the patch in Bugzilla: New option host_config_add.

cron at 8:00

howto setup mod_cron to run every day at 8:00 ?

Syndicate content