User Tools

Site Tools


softcode:cron

CobraMUSH MUSHCron

CobraMUSH utilizes Jeremy Ritter's MUSHCron system using a @cron command which simulates a Unix Crontab in much similarity.

@CRON

Syntaxes:
          @cron
          @cron/add[/<type>] <cronjob>=<cronspec> <object>/<attribute>
          @cron/set <cronjob>=[!]<flag>
          @cron/list [<cronjob>]
          @cron/delete <cronjob>
Synposis: Manages the ingame MUSHCron system.

In order to use this command you must possess the 'Cron' Power. This command alone with no switches will display all the @cron specs you control.

@cron/add creates or alters the job named <cronjob>.  The <type> given
specified whether the attribute holds functions or commands.  If
<object> is "global" then the cronjob will execute the job on all
objects the 'executor' that adds the cronjob controls.
@cron/set sets or unsets a flag on <cronjob>. Valid flags are:
  COMMAND
  FUNCTION  (not enabled as of this writing)
  HALT

A cronjob may only be of the 'COMMAND' type as now for executing, functions are disabled. If the Halt status is set on a @cron job then the job will not be processed.

@cron/list will show information about the cronjobs. If you specify
<cronjob> you will see more information about the cronspec for that job.
@cron/delete will remove <cronjob> from the crontab.

2 Default global cronjobs are included, being an 'Hourly' and a 'Daily'

Daily spec triggering the 'Daily' attribute at the beginning of each day and the Hourly spec triggering the 'Hourly' Attribute at the beginning of each Hour.

A cronspec describes at which time a cronjob will be executed. The fields of a valid cronspec are as follows:

  <minutes> <hours> <days of month> <months> <days of week>
    0-59     0-23        0-30         0-11         0-6
                                    Jan-Dec      Sun-Mon

Each field may contain a range of numbers, e.g. 2-5, or a * to indicate 0 through the maximum for that field.

A skip value can be used to select values from a range. It is specified as /<skip>, e.g. 0-23/2 would execute at 0, 2, 4, etc. until 22.

You can specify a list of values in each field, seperated with a comma. e.g. 0,2,4,6,10-14,20-30/5.

For the months and days of the week you may specify the english names or 3 letter abbreviations. January and Sunday are 0.

* * * * * Every minute of every day
30 * * * * Run every half hour.
*/30 * * * * Run every 30 minutes.
15 6,18 * * * 6:15 am and pm
20 4 20 April * Do something once a year
*/2 * * * * Do it every 2 minutes

Examples:

@cron/add/command global_trigger_monday=0 0 * * Monday global/TRG_MONDAY

softcode/cron.txt · Last modified: 2018/06/23 00:30 (external edit)