AirBuild services

Have your app's backend do something by itself every hour or every day, check that it ran, and change or stop it.

Your app’s backend on AirHost can do some work by itself on a schedule: every hour, every night, every Monday. For example, it can delete old guest carts from the database, fetch new prices from another website, or add up yesterday’s orders. The job is part of one of your backend’s services and runs on AirHost, with no Agent and none of your devices involved. Your Agents set it up with the workers cron commands: see workers.

The job needs a service on AirHost to belong to. If the Project’s Hosting tab is still empty, ask your Agents to set up hosting first: see Host your app’s backend, database and sign-in (AirHost).

Ask for a job

  1. Open the Project’s chat.
  2. Say what the job does and when it runs. Say which time zone you mean.
  3. Ask the Agent to tell you the job’s name, the service it belongs to, and when it runs in your time zone.

For example:

Add a job to the backend that deletes guest carts older than a week, every night at 3 AM New York time. Then tell me the job's name and when it runs in New York time.

The Agent sets the job up. When that changes the service’s code, the new deployment shows in the service’s Deployment History. See Check your backend’s logs and deploys.

Check that it ran

The Hosting tab lists your services, not their jobs. To see which jobs a service has and when they run, ask an Agent:

List the scheduled jobs on the backend and when each one runs.

Live Logs shows what a service prints while the page is open. See Check your backend’s logs and deploys. The app doesn’t say whether a scheduled run shows there, so to check that a job ran, ask an Agent:

Did the cart cleanup run last night? Tell me what it did.

You can also look at what the job changed: for example, open the table it cleans up in Databases. See Look inside your app’s database.

Change or stop a job

Ask in the Project’s chat. Name the job, or describe it:

To Ask, for example
Run it at another time “Run the cart cleanup every hour instead.”
Change what it does “Have the cart cleanup also delete empty wish lists.”
Stop it “Delete the cart cleanup job.”

Changing what a job does changes the service’s code, so the Agent deploys the service again.

Questions

Does the job run when my devices are off?
Yes. It runs on AirHost, not on your iPhone, your Mac or the Mac your Team runs on.
Can I see yesterday's runs?
Not in Live Logs: it shows only what happens while it’s open. Ask an Agent whether the job ran. To keep a record, ask the Agent to have the job write each run to a database table, for example the time and what it did. You can then read that table in Databases.
The job ran at the wrong hour
Ask the Agent to tell you the job’s time in your time zone, and to set it again for the hour you want.
Should I use a backend job or a Schedule?
Use a backend job for work your app’s own code does, the same way every time, such as cleaning up data. Use a Schedule when you want an Agent to look at something and act or report, such as checking crashes every morning. See Schedule work for an Agent.