Module 4 · Advanced Practical Projects

Automation that runs on its own: trigger, queue and log

Lesson 11 of 15 9 min lesson Updated on October 30, 2026
Progress in the course73%

In this lesson

Automation needs a plan.

Automation means having a machine take care of repeated tasks, such as chasing a deadline or answering a form. When it fails without warning, it can repeat the same action for weeks. Here you learn to build one that tells you when something goes wrong.

Four parts in every automation

If the decision fits in one sentence, such as "the subject contains the word urgent", use a rule. AI comes in when the input is free text, such as "the customer seems about to cancel".

Time trigger: the clock

Cron is the scheduler on almost every Linux system. Each line gives the minute, hour, day, month and day of the week, and then the command. It runs in a minimal environment, without the path and the virtual environment of your terminal. So use full paths and save the output to a log file.

What the pros know

In cron, */23 in the hour field does not mean "every 23 hours". The cron manual explains that the step is applied within the field's range, which goes from 0 to 23, and so the task runs at hours 0 and 23 of each day, not at 23-hour intervals. People who schedule for real pick steps that divide the day evenly, such as */6 or */12, or write the exact hour, and test the next run before they trust it.

Event trigger and queue

A webhook is an address of yours that another system calls when something happens, such as a confirmed payment. Check the digital signature the provider sends along with it, so you do not accept a fake notification. Respond quickly, accept duplicates and do not count on the order of the notifications.

The queue is a list of tasks in a simple database, such as SQLite. Each row has a unique key, such as the notification number. With it, the repeated item is ignored: the action is idempotent, that is, repeating it produces the same effect as doing it only once. A worker, a program that runs every few minutes, reserves an item, runs it and saves the result on the row.

If an item fails, the wait grows with each attempt. After about six attempts, it goes to a dead-letter queue, where someone can fix it.

AI as a step

The AI can read an email and return the category and a confidence score. That score is self-assessment, not a measured probability. The threshold, the minimum score for acting without a person, should come from measurement: for one week, keep the category, the confidence and the human correction, and choose the point where the error is acceptable.

Items below the threshold, requests to talk to someone and the "other" category go to a human queue, with the suggestion already filled in.

Runs on its ownAlways with human approval
Classifying and filling in fieldsMoving money: refund, chargeback
Putting a draft togetherDeleting or overwriting data
Notifying the teamChanging access; mass messages; legal matters

Careful

The text of an email is data, not an order. If the message says "ignore the rules", the protection is in the code: the dangerous tool simply does not exist for the AI. And the most dangerous error is silence. A cron job that stopped produces no error at all. Build a checker that alerts when work comes in and nothing comes out.

Practice · 5 min

  1. Pick a repeated job of yours, such as receiving invoices by email, and write down the trigger, work, effect and log.
  2. Mark what is a rule, what needs AI and which effect cannot be undone.
  3. Write in three lines the rule that sends a case to a person.
Deliverable: a drawing in four parts, with the marks and the rule for the human queue.

Summary

Sources

Read on October 30, 2026.

  1. Linux man-pages. crontab(5): cron fields and steps.
  2. Stripe. Webhooks: signature, retries and duplicates.
  3. SQLite. Transactions.

Lesson quiz

Three situations to apply what you learned.

Lesson 11 of 15

Before moving on to the next lesson

Put what you saw into practice. The boxes stay checked in this browser, so you can come back later.

Have a question about this lesson? The IV Help team answers personally on WhatsApp.

Ask on WhatsApp