ejabberd-contrib/mod_cron
Badlop 7e2fe1b789 Improve mod_cron to support ctl and command options (#307) 2022-04-11 17:36:46 +02:00
..
conf Modules that require configuration, provide it commented (#303) 2021-07-07 21:53:44 +02:00
src Improve mod_cron to support ctl and command options (#307) 2022-04-11 17:36:46 +02:00
COPYING Update FSF address (solves #73) 2015-02-25 15:17:31 +01:00
ChangeLog Initial import from ejabberd-modules SVN 2013-04-15 12:03:14 +02:00
README.txt New option args_type useful when the function expects arguments as strings 2022-01-05 12:45:41 +01:00
mod_cron.spec Cleanup for module packaging support in ejabberd 2015-03-11 14:19:35 +01:00

README.txt

	mod_cron - Execute scheduled commands

	Requires: ejabberd 19.08 or higher
	http://www.ejabberd.im/mod_cron
	Author: Badlop


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
	===================

Add the module to your ejabberd.yml, on the modules section:
modules:
  mod_cron: {}


	TASK SYNTAX
	===========

Tasks are described with those 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.
* Arguments is an array. By default strings will be converted to binaries.
* args_type can be set to string, if the function expects strings instead of 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.  

  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.

	EXAMPLE TASKS
	=============

Example configuration with some tasks:
modules:
  mod_cron:
    tasks:
      - time: 3
        units: hours
        module: mnesia
        function: info
        arguments: {}
        timer_type: fixed
      - time: 10
        units: seconds
        module: ejabberd_auth
        function: try_register
        arguments: 
          - "user1"
          - "localhost"
          - "somepass"
        timer_type: interval
      - time: 24
        units: hours
        module: mnesia
        function: backup
        timer_type: interval
        args_type: string
        arguments:
          - "/var/log/ejabberd/mnesia.backup"


	EJABBERD COMMANDS
	=================

This module provides two new commands that can be executed using ejabberdctl:
* cron_list: list scheduled tasks
* cron_del taskid: delete this task from the schedule


	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.