TinyMUX

Cron

Topics

Overview

TinyMUX provides a cron scheduling system that allows game administrators to schedule commands to run at specified times. The syntax follows the standard Unix cron format, and the system supports Vixie-style semantics for day-of-month and day-of-week interaction.

Commands

@cron

@cron <object>/<attribute> = <minute> <hour> <dom> <month> <dow>

Schedules the command in <attribute> on <object> to execute according to the cron time specification. The five time fields follow standard Unix cron syntax:

  • minute – 0-59
  • hour – 0-23
  • dom – Day of month, 1-31
  • month – 1-12
  • dow – Day of week, 0-6 (0 = Sunday)

Each field accepts single values, comma-separated lists, ranges (e.g., 1-5), step values (e.g., */15), and the wildcard *.

@crondel

@crondel <object>/<attribute>

Removes a previously scheduled cron entry.

@crontab

@crontab

Lists all currently scheduled cron entries, showing the object, attribute, and time specification for each.

Vixie-Style DOM/DOW Semantics

When both day-of-month and day-of-week are specified (i.e., neither is *), the cron system uses OR-semantics: the job fires if either the day-of-month matches or the day-of-week matches. This follows the convention established by Vixie cron and matches the behavior most Unix administrators expect.

For example, 0 12 15 * 1 fires at noon on the 15th of every month and also at noon on every Monday.

Persistence

Cron entries are not persisted across server restarts. To ensure scheduled tasks survive a reboot, recreate them in @startup attributes. A common pattern is to place all @cron definitions on a single cron manager object and trigger them from that object’s STARTUP attribute.

Examples

Run a cleanup command every hour on the hour:

@cron #123/HOURLY_CLEANUP = 0 * * * *
&HOURLY_CLEANUP #123=@dolist [search(type=THING)]=@clean ##

Run a daily announcement at 8:00 AM:

@cron #123/DAILY_ANNOUNCE = 0 8 * * *
&DAILY_ANNOUNCE #123=@wall/pose The day begins anew.

Run a weekly database report every Sunday at midnight:

@cron #123/WEEKLY_REPORT = 0 0 * * 0
&WEEKLY_REPORT #123=@pemit *wizard=[stats()]

Run a task on the first of every month at noon:

@cron #123/MONTHLY_RESET = 0 12 1 * *
&MONTHLY_RESET #123=@pemit *wizard=Monthly reset complete.

Run a task every 15 minutes:

@cron #123/QUARTER_HOUR = */15 * * * *
&QUARTER_HOUR #123=@tr me/CHECK_QUEUES

Recreate cron entries at startup:

&STARTUP #123=@cron me/HOURLY_CLEANUP = 0 * * * *;@cron me/DAILY_ANNOUNCE = 0 8 * * *;@cron me/WEEKLY_REPORT = 0 0 * * 0

List active cron entries:

> @crontab
Obj       Attribute       Minute Hour DOM Month DOW
#123      HOURLY_CLEANUP  0      *    *   *     *
#123      DAILY_ANNOUNCE  0      8    *   *     *
#123      WEEKLY_REPORT   0      0    *   *     0

@cron, @crondel, @crontab, @startup, Semaphores.