Skip to main content

sched – The Schedule Module

Last updated March 2020

The sched module is used to schedule tasks that can be run from the console.

Configuration

The following configuration stanza loads the sched module:

sched {
  backing_store = "/path/to/sqlite.db"
}

backing_store defines the path to a SQLite database. If the specified file does not already exist it will be created. The directory containing this database file must be writable by the user/group that the Momentum instance is running as, typically ecuser. Specifying a backing_store is not a requirement but if it is not specified any scheduled tasks will be forgotten when the instance is restarted.

71.59.1.1. sched Management Using Console Commands

The sched module can be controlled through ec_console. The following commands are available:

sched at *`seconds`* *`command`*

Run a command at the specified time expressed as a Unix timestamp.

sched delete *`id`*

This command deletes a scheduled job. To determine the job id use the sched list command. The delete command removes a job from memory and from the database.

sched every *`seconds`* *`command`*

Create a recurrent command that repeats at the specified interval.

sched in *`seconds`* *`command`*

Run a command at the specified number of seconds from the current time.

sched list

List any scheduled tasks. The output of this command is shown in the following:

JOB ID        	    NEXT RUN TIME	REC	COMMAND
example.com-000000005	1215702990	 y	config set message_expiration 300

The output shows the job id followed by the scheduled run time expressed in Unix timestamp format. If the job is recurrent a ‘y’ appears under the REC column. A command will only be recurrent if it is invoked using every. The scheduled command appears under the COMMAND column.

Was this page helpful?