User Tools

Site Tools


trigger:Cron

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
trigger:Cron [2017/09/04 04:12]
peternlewis
trigger:Cron [2021/11/24 01:45] (current)
peternlewis
Line 1: Line 1:
-The *Cron trigger* lets you execute a macro periodically while you are logged in.+====== Cron Trigger ====== 
 + 
 +The *Cron* ​trigger (v8+) lets you execute a macro periodically while you are logged in.
  
 The Cron format lets you specify when a trigger will fire based on the time of day and and day of month and week. The Cron format lets you specify when a trigger will fire based on the time of day and and day of month and week.
Line 12: Line 14:
 * Optional year (2000-2099) * Optional year (2000-2099)
  
-Each field can be a single number, or it can be a range (eg "​3-7"​) or a set of numbers or ranges separated by commas (eg "​3,​5-7,​9"​). ​ Alternatively,​ the field can be "*" ​which matches all values. ​ You can also add "/" ​and a number after a range to match every N'th value (eg "​0-25/​5"​ will match every five minutes in the first half of the each hour).+Each field can be a single number, or it can be a range (eg "​3-7"​) or a set of numbers or ranges separated by commas (eg "​3,​5-7,​9"​). ​ Alternatively,​ the field can be `*which matches all values. ​ You can also add `/and a number after a range to match every N'th value (eg "​0-25/​5"​ will match every five minutes in the first half of the each hour).
  
 For the Day of Week and Month fields, you can use the first three letters of the English name (eg "​Jan"​ for January (1), or "​Sun"​ for Sunday (0)). For the Day of Week and Month fields, you can use the first three letters of the English name (eg "​Jan"​ for January (1), or "​Sun"​ for Sunday (0)).
Line 18: Line 20:
 If the field starts with a minus sign (-), it matches from the end of the range (eg -1 in day of the month means the last day of the month). If the field starts with a minus sign (-), it matches from the end of the range (eg -1 in day of the month means the last day of the month).
  
-The trigger will match when all fields match the current time (as each minute ticks over). ​ Exception: if either day of month or day of week is "*" ​and the other isn't, then the trigger will match only the non-* field, otherwise the trigger will match when **either** field matches.+The trigger will match when all fields match the current time (as each minute ticks over). ​ Exception: if either day of month or day of week is `*and the other isn't, then the trigger will match only the non-`*field, otherwise the trigger will match when **either** field matches.
  
 If you start the day of the month field with a "​+",​ then the trigger will match only if both the day of the week and day of the month field matches. ​ This allows you to match the last Friday of the month using "​-1-7"​ for the day of the month, and "​+Fri"​ for the day of the week. If you start the day of the month field with a "​+",​ then the trigger will match only if both the day of the week and day of the month field matches. ​ This allows you to match the last Friday of the month using "​-1-7"​ for the day of the month, and "​+Fri"​ for the day of the week.
Line 24: Line 26:
 Alternatively,​ the entire field can be one of: Alternatively,​ the entire field can be one of:
  
-* `@yearly` or `annually` — same at `0 0 1 1 *` (midnight at the start of January 1st each year). +* `@yearly` or `annually` — same as `0 0 1 1 *` (midnight at the start of January 1st each year). 
-* `@monthly ` — same at `0 0 1 * *` (midnight at the start of the 1st of each month). +* `@monthly ` — same as `0 0 1 * *` (midnight at the start of the 1st of each month). 
-* `@weekly ` — same at `0 0 * * 0` (midnight at the start of the each Sunday). +* `@weekly ` — same as `0 0 * * 0` (midnight at the start of the each Sunday). 
-* `@daily ` or `@midnight` — same at `0 0 * * *` (midnight at the start of the each day). +* `@daily ` or `@midnight` — same as `0 0 * * *` (midnight at the start of the each day). 
-* `@daily ` — same at `0 0 * * *` (midnight at the start of the each day). +* `@noon ` — same as `0 12 * * *` (noon in the middle of the each day). 
-* `@noon ` — same at `0 12 * * *` (noon in the middle of the each day). +* `@hourly ` — same as `0 * * * *` (at the start of each hour)
-* `@hourly ` — same at `0 * * * *` (at the start of each hour).+ 
 +The [[token:​TriggerValue|%TriggerValue%]] token will hold the current time and date (`yyyy-mm-dd hh:mm`). 
 + 
 +Remember that your Mac **must** be awake for any trigger to run, and that if the screen is sleeping, locked, or screen saving, then UI actions generally will not work.
  
 ===== Examples ===== ===== Examples =====
  
-`1 0 * * *` — triggers at one minute past midnight each day. +^ Cron Setting ^ When Macro Triggers ^ 
-`45 23 * * 6` — triggers at 23:45 (15 minutes before midnight) near the end of each Saturday. +`1 0 * * *` | AT one minute past midnight each day | 
-`0 12 * * Mon` — triggers at noon each Monday. +`45 23 * * 6` | AT 23:45 (15 minutes before midnight) near the end of each Saturday ​| 
-`0 18 * * Fri` — triggers at 6pm each Friday. +`0 12 * * Mon` | AT noon each Monday ​| 
-`0 9,12,18 * * *` — triggers at 9am, 12am and 3pm each day. +`0 18 * * Fri` | AT 6pm each Friday ​| 
-`* * * * 1-5` — triggers at every minute on workdays. +`0 9,12,18 * * *` | AT 9am, 12am and 3pm each day | 
-`*/15 * * * *` — triggers at every quarter hour. +`* * * * 1-5` | AT EVERY minute on workdays ​| 
-`0 18-23,0-8 * * *` — triggers at every hour outside office hours. +`*/15 * * * *` | AT EVERY quarter hour | 
-`0 12 1 Apr *` — triggers at noon on April 1st. +`0 18-23,0-8 * * *` | AT EVERY hour outside office hours | 
-* `0 12 15 * *` — triggers at noon the 15th of each month. +`0 12 1 Apr *` | AT noon on April 1st | 
-`0 12 15 * Mon` — triggers at noon each Monday and the 15th of each month. +| `30 8 17 Apr 2019` | AT 8:30am on 17 April, 2019 | 
-`0 12 15 * +Mon` — triggers at noon each 15th of each month if it is a Monday. +`0 12 15 * *` | AT noon the 15th of each month | 
-`0-59/5 * * * *` — triggers every five minutes (at :00, :05, :10, etc). +`0 12 15 * Mon` | AT noon each Monday and the 15th of each month | 
-`3-59/5 * * * *` — triggers every five minutes (at :03, :08, :13, etc).+`0 12 15 * +Mon` | AT noon each 15th of each month if it is a Monday ​| 
 +`0-59/5 * * * *` | EVERY five minutes (AT :00, :05, :10, etc) | 
 +`3-59/5 * * * *` | EVERY five minutes (AT :03, :08, :13, etc) 
 +| `30 8 1-7 * +Sat` | AT 8:30 am on the first Saturday of each of month |
  
 ===== See Also ===== ===== See Also =====
  
-* [[https://​en.wikipedia.org/​wiki/​Cron|Cron]] format. ​ None of the Non-standard characters are supported except the slash (/). +=== Actions === 
-* [[https://​healthchecks.io/​docs/​cron/​|HealthChecks.io examples]].+ 
 + * [[:​Actions|See all Actions]] 
 + 
 +=== Tokens === 
 + 
 +* [[token:​Trigger|%Trigger%]] 
 +* [[token:​TriggerBase|%TriggerBase%]] 
 +* [[token:TriggerValue|%TriggerValue%]] 
 +* [[:Tokens|See all Tokens]]
  
 === Triggers === === Triggers ===
  
 * [[Periodic|Periodic]] trigger * [[Periodic|Periodic]] trigger
-* [[Time]] trigger+* [[Time ​of Day]] trigger 
 +* [[Idle]] trigger
 * [[/​Triggers|All Triggers]] * [[/​Triggers|All Triggers]]
 +
 +===== Forum =====
 +
 +* [[https://​en.wikipedia.org/​wiki/​Cron|Cron]] format. ​ None of the Non-standard characters are supported except the slash (/).
 +* [[https://​healthchecks.io/​docs/​cron/​|HealthChecks.io examples]].
 +
trigger/Cron.1504512756.txt.gz · Last modified: 2017/09/04 04:12 by peternlewis