Skip to content

Run locking

Automax can protect operational runs from accidental concurrency with file-based locks.

automax run \
  --job jobs/deploy.yaml \
  --inventory inventory/prod.yaml \
  --lock

By default --lock uses --lock-scope both, which acquires:

  • one job-level lock: job:<job-name>;
  • one target-level lock for each selected server: target:<server-name>.

Available scopes:

automax run ... --lock --lock-scope job
automax run ... --lock --lock-scope target
automax run ... --lock --lock-scope both

Use --lock-timeout to wait for a lock instead of failing immediately:

automax run ... --lock --lock-timeout 30

Locks live next to the state directory, under .automax/locks when the default .automax/runs state path is used. Locks are released at the end of the run, including failed runs.