All help articles

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:

The jobs

JobRunsDoes
Help desk mailevery minuteReads the help desk queues' mailboxes (new tickets and replies) and sends replies staff scheduled for later.
Account syncevery minuteKeeps new mailboxes and staff in step with Zappocity accounts, moves old platform tickets to the help desk, clears spent sign-in codes.
BillinghourlyInvoices subscriptions that are due, charges saved payment methods, sends the invoices.
DeletionshourlyDeletes the mailboxes and Zappocity accounts whose grace period is over.
Archive retentionhourlyRemoves archived mail past its team's retention, except mail on legal hold.
History clean-uphourlyDrops sign-in history, mail log lines, greylist entries and sync records older than they are kept.
Unused filesevery 6 hoursDeletes message files and attachments nothing uses any more, a day after they were last stored.
New domains' DNSevery 10 minutesChecks the DNS of domains still being set up, and tells their team once everything is in place.
Automatic DNSevery 10 minutesPublishes the records of domains with automatic DNS, each at most hourly.
Teams' host namesevery 30 minutesChecks 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:

Changing them

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).