Internet Explorer is no longer supported. Many things will still work, but your experience will be degraded and some things won't function. Please use a modern browser such as Edge, Chrome, or Firefox.

Scheduled & Recurring Jobs

view on GitHub

While Jobs and Templates allow you to create self-service templates that let anyone run complex scripts, Scheduled and Recurring Jobs allow you to use jobs in Otter to automate routine and recurring tasks using the built-in scheduler or your existing, third-party scheduler.

Scheduling Jobs to Run in the Future

When running a job (whether from a template, ad-hoc, or remediating drift), select a start time:

  • Run now
  • Specify date/time to run

By specifying a date/time to run the job, you can avoid downtime during work hours and other high-use times.

Integrating with Your Existing Job Scheduler

For complex job scheduling, you should integrate your preferred, dedicated job scheduler.

Otter can work with any job scheduler by using the Job Orchestration API. It can be as simple as using an HTTP post or PowerShell:

Invoke-WebRequest -URI "https://«otter-host»/api/jobs/trigger?template=«template-name»&key=«secret-key"

Creating a job from the API first involves creating an API key with the “Job Orchestration” permission.

You can also restrict the job to a specific API key, which may be useful if you’re using different tools and scripts run different jobs in Otter.

When triggering jobs from the API, the job template’s variable prompts will be used to validate input:

  • If a variable is marked "required" but is not passed as a parameter, an error will be raised
  • If you pass a parameter that isn’t specified as a variable prompt, an error will be raised

If you select “Allow new variables when creating a job,” you can pass in any number of variable name/values when running the job from the API.

Creating a Recurring Job

You can create a recurring job by navigating to Jobs > Upcoming & Recurring > Create Recurring Jobs.

You can alternatively navigate to the script you’d like to run and select “Create a Recurring Job” from that script.

Like ad-hoc jobs, you must specify the script to run and server targeting for recurring jobs.

Schedule a Recurring Job

If you need to run a job more than once in the future, use a recurring job. This can avoid down-time during work hours and other interruptions.

There are four options for scheduling recurring jobs:

  • every day
  • every week
  • every month
  • custom

Custom schedules are defined with a Quartz-flavored Cron expressions. These can be a bit complex (see cron expression syntax), but if you search online for "cron expression generators" you may find a tool you like. For example: https://freeformatter.com/cron-expression-generator-quartz.html

Variables for a Recurring Job

Variables are used as parameters for the script before its executed as a recurring job. You can enter variable name/values, with one variable on each line.

Remediating Drift on a Recurring Basis

A lot of configuration requires reboots or require resource-intensive operations. It therefore may be useful to remediate drift on testing environments on a nightly basis, as to not interrupt QA teams during the day.

You can also create a recurring job that will remediate drift. Navigate to Jobs > Upcoming & Recurring > Create Recurring Job and select “Remediate Drift on a Recurring Basis.”

You can target servers directly (by name) or indirectly (by roles/environments).

remediating-drift-on-a-recurring-basis