Keep it running
Work that runs on a schedule — and how to see what it printed
A nightly cleanup, a weekly report, a reminder at eight. One command, and it runs with the same image and the same environment your app already has.
Add one
A name, a cron expression, and the command. The five fields are the ordinary ones — minute, hour, day of month, month, day of week — so 0 3 * * * is three in the morning, every day.
The clock is UTC
Not your timezone, and this is the one that catches people. Bangkok is UTC+7, so a job that should run at 3 am local is 0 20 * * * — the evening before. Getting it wrong does not fail; it runs, at a time you did not mean, and the report arrives at lunch.
What it runs as
Your app's image and your app's environment, which means the database connection, the keys and everything else are already there. A task is your own code run on a timer, not a separate little program with its own setup — and when you deploy a new version, every task moves to the new image with it.
See what happened
The second is what the last run printed. Worth knowing before you need it: a task that fails quietly at three in the morning looks exactly like a task that was never added.
Remove one
Deleting the app deletes its tasks with it — there is no schedule left running against something that is gone.
Try the command first
Same image, same environment, once, now. Finding out at 3 am that the command was misspelled is a slow way to learn it.