Skip to content

Background and scheduled audits

Without serve, each command starts Damdit CLI for as long as it runs: damdit-cli audit audits in the foreground and ends when the audit is done. damdit-cli serve keeps Damdit CLI running in the background instead. It:

  • runs scheduled audits,
  • runs audits started with damdit-cli audit --detach,
  • answers commands and AI agents started meanwhile; they share it.
Terminal window
damdit-cli serve # starts it in the background
damdit-cli logs # its log; add -f to follow it
damdit-cli stop # stops it

serve runs in the Docker container damdit-cli. Docker starts it again when Docker itself starts, until you run damdit-cli stop. Scheduled audits run only while Docker runs and the computer is awake.

The log has one line per event: started, an audit queued or due, started, finished with its score, failed or cancelled, and stopping. Set DAMDIT_LOG=json before serve for JSON lines instead.

serve takes the DAMDIT_* variables set when you start it, such as DAMDIT_CI_KEY and DAMDIT_PAGESPEED_KEY. It keeps them in a file only your user can read, and stop removes it. Docker doesn’t keep them in the container’s settings.

To change a variable, stop serve and start it again:

Terminal window
damdit-cli stop
export DAMDIT_PAGESPEED_KEY=…
damdit-cli serve

The access level of serve (DAMDIT_CLI_ACCESS) is the most any command or AI agent may do through it. See Access levels.

Terminal window
damdit-cli schedule Example weekly --weekday monday --hour 6
damdit-cli schedule Example daily --hour 3
damdit-cli schedule Example monthly --day 1
damdit-cli schedule Example off
  • --hour is a whole hour, 0–23 (9 by default). A weekly schedule takes --weekday (Monday by default), a monthly one --day, 1–28 (1 by default). Values you don’t give stay as saved.
  • Hours are in this computer’s time zone: the launcher passes it to Docker. serve’s first log line names the time zone.
  • A scheduled audit is the same Full Audit as any other. It audits the project’s default address.
  • Scheduled audits run only while damdit-cli serve runs. They can’t be stopped with damdit-cli cancel; damdit-cli stop stops a running one.

damdit-cli update moves an idle serve to the new version with the same variables. If serve is auditing, it keeps the previous version until you run damdit-cli update again after the audit.