2013-04-15 12:03:14 +02:00
|
|
|
|
|
|
|
mod_cron - Execute scheduled commands
|
|
|
|
|
|
|
|
http://www.ejabberd.im/mod_cron
|
|
|
|
Author: Badlop
|
2015-01-28 13:55:56 +01:00
|
|
|
Requirements: ejabberd git master
|
2013-04-15 12:03:14 +02:00
|
|
|
|
|
|
|
|
|
|
|
This module allows advanced ejabberd administrators to schedule commands for
|
|
|
|
periodic and automatic execution. This module is a similar concept than the
|
|
|
|
*nix's cron program. Obviously, the admin must know in advance which module,
|
|
|
|
function and arguments to use, so this module is not intended for starting
|
|
|
|
administrators.
|
|
|
|
|
|
|
|
Each time a scheduled task finish its execution, a message is printed in the
|
|
|
|
ejabberd log file.
|
|
|
|
|
|
|
|
|
|
|
|
BASIC CONFIGURATION
|
|
|
|
===================
|
|
|
|
|
2015-01-28 17:12:59 +01:00
|
|
|
Add the module to your ejabberd.yml, on the modules section:
|
|
|
|
modules:
|
|
|
|
mod_cron: {}
|
2013-04-15 12:03:14 +02:00
|
|
|
|
|
|
|
|
|
|
|
TASK SYNTAX
|
|
|
|
===========
|
|
|
|
|
2015-01-28 17:12:59 +01:00
|
|
|
Each task is described with five elements:
|
|
|
|
* Time is an integer.
|
|
|
|
* Units indicates the time unit you use. It can be: seconds, minutes, hours, days.
|
|
|
|
* Module and * Function are the exact call you want to schedule.
|
2015-02-11 23:26:35 +01:00
|
|
|
* Arguments is an array. Strings will be converted to binaries.
|
|
|
|
* timer_type is one of 'fixed' or 'interval'. Fixed timers occur at a fixed time
|
|
|
|
after the [minute|hour|day] e.g. every hour on the 5th minute (1:05PM, 2:05PM etc)
|
|
|
|
interval timers occur every interval (starting on an even unit) e.g. every 10 minutes
|
|
|
|
starting at 1PM, 1:10PM, 1:20PM etc.
|
2013-04-15 12:03:14 +02:00
|
|
|
|
2015-02-11 23:26:35 +01:00
|
|
|
Fixed timers are the equivalent of unix cron's comma syntax e.g. "2 * * *" and interval
|
|
|
|
timers are the / syntax e.g. "*/5 * * *".
|
|
|
|
|
|
|
|
Default timer_type is interval.
|
2013-04-15 12:03:14 +02:00
|
|
|
|
2015-01-28 17:12:59 +01:00
|
|
|
EXAMPLE TASKS
|
|
|
|
=============
|
2013-04-15 12:03:14 +02:00
|
|
|
|
2015-01-28 17:12:59 +01:00
|
|
|
Example configuration with some tasks:
|
|
|
|
modules:
|
|
|
|
mod_cron:
|
|
|
|
tasks:
|
|
|
|
- time: 3
|
|
|
|
units: hours
|
|
|
|
module: mnesia
|
|
|
|
function: info
|
2015-02-11 23:26:35 +01:00
|
|
|
arguments: {}
|
|
|
|
timer_type: fixed
|
2015-01-28 17:12:59 +01:00
|
|
|
- time: 10
|
|
|
|
units: seconds
|
|
|
|
module: ejabberd_auth
|
|
|
|
function: try_register
|
2015-02-11 23:26:35 +01:00
|
|
|
arguments:
|
|
|
|
- "user1"
|
|
|
|
- "localhost"
|
|
|
|
- "somepass"
|
|
|
|
timer_type: interval
|
2013-04-15 12:03:14 +02:00
|
|
|
|
|
|
|
|
|
|
|
EJABBERD COMMANDS
|
|
|
|
=================
|
|
|
|
|
|
|
|
This module provides two new commands that can be executed using ejabberdctl:
|
2015-01-28 17:12:59 +01:00
|
|
|
* cron_list: list scheduled tasks
|
|
|
|
* cron_del taskid: delete this task from the schedule
|
2013-04-15 12:03:14 +02:00
|
|
|
|
|
|
|
|
|
|
|
WEB ADMIN
|
|
|
|
=========
|
|
|
|
|
|
|
|
This module provides a page in the Host section of the Web Admin.
|
|
|
|
Currently that page only allows to view the tasks scheduled for that host.
|