---
title: "Scheduled jobs (cron)"
description: "Run a service command or call a URL on a schedule: every night, every 15 minutes or once, in your time zone, never overlapping."
url: https://www.gyrohosting.com/developers/en/howto/container-schedule.html
language: en
openapi: https://www.gyrohosting.com/developers/openapi.json
api_version: 2.36.0
---

# Scheduled jobs (cron)

Run a service command or call a URL on a schedule: every night, every 15 minutes or once, in your time zone, never overlapping.

**curl**

```bash
# every night at 03:00 Istanbul time, retried twice
curl -s -X POST https://www.gyrohosting.com/api/v1/client/cloud/containers/12345/schedules -H "Authorization: Bearer $GYRO_TOKEN" -H "Content-Type: application/json" \
  -d '{"name":"nightly-report","cron":"0 3 * * *","timezone":"Europe/Istanbul","service":"api","command":["npm","run","report"],"retries":2}'
# call your own endpoint every 15 minutes (headers are kept secret)
curl -s -X POST https://www.gyrohosting.com/api/v1/client/cloud/containers/12345/schedules -H "Authorization: Bearer $GYRO_TOKEN" -H "Content-Type: application/json" \
  -d '{"name":"queue-tick","rate_minutes":15,"url":"https://api.example.com/cron","method":"POST","headers":{"Authorization":"Bearer ..."}}'
curl -s https://www.gyrohosting.com/api/v1/client/cloud/containers/12345/schedules/nightly-report -H "Authorization: Bearer $GYRO_TOKEN"
```

**CLI**

```bash
gyro container schedule create 12345 nightly-report --cron "0 3 * * *" --service api --retries 2 -- npm run report
gyro container schedule create 12345 queue-tick --every 15m --url https://api.example.com/cron --method POST --header "Authorization: Bearer $TOKEN"
gyro container schedule list 12345
gyro container schedule run-now 12345 nightly-report
gyro container schedule pause 12345 nightly-report
```

**Terraform**

```hcl
resource "gyro_container_schedule" "report" {
  environment_id = 12345
  name           = "nightly-report"
  cron           = "0 3 * * *"
  timezone       = "Europe/Istanbul"
  service        = "api"
  command        = ["npm", "run", "report"]
  retries        = 2
}
```

Timing: `cron` (5 fields, `@daily` / `@hourly` too), `rate_minutes` or `at` (once), following `timezone` (IANA name, default `Europe/Istanbul`). `POST .../schedules/preview` shows the next run times. A service target runs as a [one-off job](https://www.gyrohosting.com/developers/en/howto/container-job.md) with the image of the running version at that moment, its variables and secrets; an HTTP target is called from your environment (no redirects, HTTP 400+ fails, private and platform addresses are not reachable; your service's internal address `http://<service>.<namespace>.svc.cluster.local` is).

A run never starts while the previous run of the same schedule is still going (`skipped`). A run that could not start in time is `missed`. Failed runs are retried 30 s × attempt apart (`retries` 0-3); then the `schedule_failed` alert goes to your notification channels (also `schedule_missed`), at most once per schedule per cooldown. Shortest interval 1 minute (Serverless 5); schedules per environment 5 on Serverless and plans up to 2 vCPU, 10 otherwise (`GET /cloud/account/limits`, raised with a support ticket). Free on node plans; on Serverless each run is billed like a task.
