Scheduled jobs
The server does some of its work on a schedule: reading the help desk's mail, billing, deleting what is due to go, clean-ups and checks. Each of these is a scheduled job. In either admin panel, Settings → Scheduled jobs lists them with:
- how often each runs (its own interval, or yours);
- its last run: when, how long it took, what it did ("3 invoices made", "12 files and 12 records removed") or the error, and what started it;
- how many times it has run and failed;
- when it runs next.
The jobs
| Job | Runs | Does |
|---|---|---|
| Help desk mail | every minute | Reads the help desk queues' mailboxes (new tickets and replies) and sends replies staff scheduled for later. |
| Account sync | every minute | Keeps new mailboxes and staff in step with Zappocity accounts, moves old platform tickets to the help desk, clears spent sign-in codes. |
| Billing | hourly | Invoices subscriptions that are due, charges saved payment methods, sends the invoices. |
| Deletions | hourly | Deletes the mailboxes and Zappocity accounts whose grace period is over. |
| Archive retention | hourly | Removes archived mail past its team's retention, except mail on legal hold. |
| History clean-up | hourly | Drops sign-in history, mail log lines, greylist entries and sync records older than they are kept. |
| Unused files | every 6 hours | Deletes message files and attachments nothing uses any more, a day after they were last stored. |
| New domains' DNS | every 10 minutes | Checks the DNS of domains still being set up, and tells their team once everything is in place. |
| Automatic DNS | every 10 minutes | Publishes the records of domains with automatic DNS, each at most hourly. |
| Teams' host names | every 30 minutes | Checks that teams' own host names point here. |
Every job runs once when the server starts, if it has not run within its interval. Faster work keeps its own pace and is not listed:
- the outgoing mail queue;
- push notifications;
- mailbox imports;
- spam training;
- messages scheduled to send later.
Changing them
- Run now runs a job straight away, even a paused one. Its next run is then counted from this one.
- Pause stops a job running on its schedule until you choose Resume. Pause billing while you fix a price, for example; Run now still works.
- Interval sets how often it runs: from every minute to once a week. Leave it empty to go back to the job's own interval.
Several servers
With several servers on one database, each job runs on one server at a time. The server running it claims it in the database and renews the claim every minute while it runs. If that server stops, its claim runs out after three minutes and another server takes the job.
With Zappocity running apart
When the platform runs as zappocityd, it runs help desk mail, billing, Zappocity account deletions and the sign-in clean-up in its own scheduler, with their state in its own database. The mail server keeps account sync, mailbox deletions and its own clean-ups. The panel's Scheduled jobs page then has a second card, Zappocity's scheduled jobs, where you run, pause and reschedule zappocityd's jobs the same way (the mail server passes your choice on to it). In one process that card is not shown, as the first has every job.
Command line and API
corpsuite jobs
corpsuite job run blob-cleanup
corpsuite job set billing enabled:=false
corpsuite job set dns-publish everySeconds:=3600
corpsuite job set dns-publish everySeconds:=0 # back to its own interval
corpsuite platform jobs # zappocityd's, when apart
corpsuite platform job run billing
corpsuite platform job set billing enabled:=false
On a server, corpsuite job run runs the job right there and prints how it went. In the admin API: GET /v1/jobs, PATCH /v1/jobs/{name} and POST /v1/jobs/{name}/run (settings permission to change them). See api/openapi.yaml. zappocityd's are at /v1/platform/jobs in the same form (api/platform.yaml).