Skip to content

Instantly share code, notes, and snippets.

@arcanadev
arcanadev / readme.md
Last active February 11, 2021 05:37
List all jobs and steps #adtempus #version4 #sql

This SQL query demonstrates how to list all jobs and steps in the adTempus 4.x database, including the full group name for each job.

The group name is assembled by following the group hierarchy up to a limit of 10 levels. The top level group of the hierarchy is always the "Root" group and its name is not included in the group name; jobs in the root group show an empty string for the group name.

The JobStep.StepName is populated only if a name has been set in the Console. The Console displays a description for each step that is generated from the step's settings, but this description is not stored in the database.

@arcanadev
arcanadev / listunrunjobs.ps1
Last active February 11, 2021 16:47
Find jobs not run in the last X days #adtempus #api #powershell #version4
param (
[string]$server = ".",
[int]$days = 180
)
add-type -path "c:\program files\arcana development\adtempus\4.0\ArcanaDevelopment.adTempus.Client.dll"
$cutoffDate=[DateTime]::UtcNow.Subtract([TimeSpan]::FromDays($days))
$adtempus=[ArcanaDevelopment.adTempus.Client.Scheduler]::Connect($server,[ArcanaDevelopment.adTempus.Shared.LoginAuthenticationType]::Windows,"","")
$context=$adtempus.NewDataContext()
$restartPaging=$false
@arcanadev
arcanadev / readme.md
Last active February 11, 2021 16:47
Terminate all jobs #adtempus #api #version4

This example uses the adTempus API to terminate all running jobs on the server.

@arcanadev
arcanadev / readme.md
Last active February 11, 2021 17:34
Delay execution by x seconds #adtempus #version4 #userscript

This script can be run to add a delay between job steps, response actions, etc.

To use it between job steps, insert a new step configured to run a script, and use this code as the script body.

Adjust the sleepTimeInSeconds value as appropriate to get the desired delay.

@arcanadev
arcanadev / readme.md
Last active February 11, 2021 17:34
Create a recurring schedule for a job #adtempus #api #version4

This sample uses the adTempus API to create a recurring schedule for a job.

This code assumes you have already created the job and have a DataContext names context and a Job named job.

It creates a Schedule that executes every hour from 5am to 9pm, Monday through Friday.

@arcanadev
arcanadev / readme.md
Created February 12, 2021 16:54
Find jobs that missed their scheduled executions because they were held #adtempus #api #version4

This script finds jobs that missed executions while they were held.

The script retrieves all jobs for the server and then examines those that are currently held. For each held job it retrieves the most recent execution (status.ExecutionFinish), then asks the server to calculate all expected executions beween the last execution and the current time. If any scheduled executions are found in that interval, we know that they were missed because the job was held.

@arcanadev
arcanadev / readme.md
Last active February 12, 2021 18:32
Get execution times for all jobs #adtempus #api #version4

This script retrieves scheduled execution times for all jobs on the server.

The script calls GetJobExecutionTimes to calculate the scheduled executions for all jobs on the server for the next 24 hours.

@arcanadev
arcanadev / readme.md
Last active February 16, 2021 17:24
List Job Variables defined for all groups, jobs, and steps #adtempus #api #version4

This script creates a tab-delimited file listing the Job Variables defined for all groups, jobs, and steps.

This script lists the variables explicitly defined (or overridden) at each level; it does not list inherited variables. Note that jobs may be inheriting variables defined at other levels that are not included here:

  • Server
  • Queue
  • Remote Agent

See Also

@arcanadev
arcanadev / readme.md
Last active February 16, 2021 17:24
Find overridden job variables #adtempus #api #version4

This script looks at all groups, jobs, and steps to find places where Job Variables defined at a higher level have been overridden.

The script finds all places where a group, job, or step overrides a variable that is defined at a higher level (server, group, queue, or job).

The script does not compare the variable value to the higher-level value: it only checks whether the variable has been defined at the lower level. That is, if a group has variable "Environment" defined as "Production" and a job in the group has variable "Environment" defined as "Production" that is still reported as an override, because the job has an explicit value for the variable, and if the variable is changed at the group level the job will not get the new value.

See Also:

@arcanadev
arcanadev / readme.md
Created February 16, 2021 17:43
Fetch recent job instances #adtempus #api #version4

These samples demonstrate how to retrieve recent job instances

The samples below show:

  1. Fetch all instances for the last 30 days for a job
  2. Fetch the most recent 5 instances for a job
  3. Fetch all instances for the last 30 days for all jobs. This sample also demonstrates how to use paging when fetching large amounts of data.