Schedule Cron Jobs with Terminus
Schedule and automate specific tasks or jobs.
Customer scheduled cron jobs Early Access program is closed for new participants.
While this feature is in Early Access, Pantheon's development team releases new functionality often. Please review Pantheon's Software Evaluation Licensing Terms for more information about support expectations for and access to Pantheon's pre-release software.
The Terminus Scheduled Jobs Plugin allows customers to schedule and automate specific cron jobs according to their requirements. You can specify the desired frequency (e.g., daily, weekly, monthly, hourly), and the actions to be performed. The system then executes the scheduled jobs automatically based on the provided instructions.
Requirements
Installation
To install this plugin, run the following:
For more information about installing Terminus Plugins, see Install Plugins in our Terminus Guide.
Usage
The plugin uses the following syntax:
Where:
-
<command>:<subcommand>: the Scheduled Jobs Plugin command and subcommand. See the Commands section for details. -
<site>.<env>: the site name or UUID. Useterminus site:listto retrieve a list of site names and UUIDs. -
<job_name>: a brief description of the job. -
<cron_command>: the cron command you are scheduling. The following commands cannot be used:- Outbound email via
sendmailorlocalhostSMTP is not permitted. Email can still be sent via integrations with third party email providers either via their SMTP servers or API integrations. - New Relic
- Outbound email via
-
<cron_schedule>: the schedule for the job. See this Wikipedia page for more information about cron schedules.
Jobs "Budget"
Each site has a fixed allocated budget of 300 minutes per day. This is calculated as the sum of all job durations, from the moment the job has started until it finished.
There are currently no restrictions around the number of schedules that can be created for any given site. If the daily budget is exhausted, running jobs are given a 15 minute grace period after which a timeout signal will be issued. No other jobs will be created that day until midnight UTC when all budgets are reset. In calculating the budget, partial minutes are rounded up.
Job Timeouts
Timeouts are dynamic and dependent on the remaining budget plus the 15 minute grace period. For instance, the daily available budget at the start of the day is 300 minutes, which means the first job's timeout is 315 minutes. When a job is launched throughout the day and the remaining budget is 60 minutes, the timeout will be calculated to 75 minutes.
Commands
These commands may require the following variables, indicated by <variable_name>.
-
<site>.<env>: the site name or UUID. Useterminus site:listto retrieve a list of site names and UUIDs. -
<job_name>: a brief description of the job. -
<cron_command>: the cron command you are scheduling. The following commands cannot be used: -
<cron_schedule>: the schedule for the job. See this Wikipedia page for more information about cron schedules. -
<job_ID>: The unique ID of the job, which you can find using thejobs:listcommand. -
<schedule_ID>: the unique ID of the schedule, which you can find using theschedule:listcommand.
budget:info
View your current budget status.
jobs:list
Returns a list of all active jobs.
jobs:logs
View logs associated with a job ID.
schedule:create
Creates a new scheduled job.
schedule:delete
Delete an existing schedule.
schedule:list
Generates a list of all schedules for the specified site environment.
schedule:pause
Pause a schedule.
schedule:resume
Resume a paused schedule.