Two kinds of target
An execute job runs a command with its own environment variables. A fetch job calls a path with the method you choose and the status codes you expect.
EXECUTE0 2 * * *
$ python cleanup.py
FETCH*/5 * * * *
GET /healthreturns200
Run a command in your app's environment or call one of its HTTP paths on a cron schedule. Create, pause, reschedule, and delete jobs from the same SDK.
An agent sets a schedule. The job waits until the time comes, then runs and finishes.
An illustration, with example data.
Powering products and agents at
Create a job with a name, a cron schedule, and exactly one target: a command to execute or a path to fetch.
$ npm install stackmachineimport StackMachine from "stackmachine";
const client = new StackMachine(process.env.STACKMACHINE_API_KEY);
const cleanup = await client.apps.cronjobs.create({
app: "da_XYZ",
name: "cleanup",
schedule: "0 2 * * *",
execute: { command: "python cleanup.py" },
});
const healthcheck = await client.apps.cronjobs.create({
app: "da_XYZ",
name: "healthcheck",
schedule: "*/5 * * * *",
fetch: { path: "/health", method: "GET" },
});Recurring backend work, kept next to the app it belongs to.
An execute job runs a command with its own environment variables. A fetch job calls a path with the method you choose and the status codes you expect.
EXECUTE0 2 * * *
$ python cleanup.py
FETCH*/5 * * * *
GET /healthreturns200
Set how many times a run retries, how far it may drift from its schedule, and how long it may take.
More in the documentation.
One API key for hosting, storage, databases, email, and cron.