Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Scheduled maintenance

drawbar maintenance runs git maintenance run --auto in every repository in git’s maintenance.repo registry, the list git maintenance register adds to. Each run goes through the shim, so it takes the repository’s lease and waits its turn behind agents fetching in the same clone:

$ git -C ~/src/widgets maintenance register
$ drawbar maintenance
drawbar: maintained /home/acme/src/widgets
drawbar: skipped /home/acme/src/old-clone: not a directory

Paths after the command replace the registry, as in drawbar maintenance ~/src/widgets. A registered path that is not a directory is skipped. A repository whose run fails, including one that could not get the lease within the wait, is reported, and the rest still run. The command exits 0 when nothing failed, 1 when a run failed or the registry could not be read, and 2 for a bad argument.

Plain git maintenance start never takes the lease, because git’s own scheduler runs git for-each-repo, which starts git from its exec path and skips the shim.

drawbar install --timers writes four systemd user units to $XDG_CONFIG_HOME/systemd/user, or to ~/.config/systemd/user when XDG_CONFIG_HOME is unset, and enables both timers:

ServiceRunsTimerSchedule
drawbar-maintenance.servicedrawbar maintenancedrawbar-maintenance.timerHourly, up to 10 minutes late
drawbar-gc-daemons.servicedrawbar gc-daemonsdrawbar-gc-daemons.timerDaily, up to 30 minutes late

Both services set LimitNOFILE=1048576 and put %h/.local/bin first on PATH. Both timers are persistent, so a run missed while the machine was off happens at the next boot. The templates are in deploy/ and are built into the binary, so running install --timers again after an upgrade rewrites them to match. Change them with systemctl --user edit <unit> drop-ins, which install leaves alone.

Install refuses, and changes nothing, when a file at one of those names was not written by drawbar, the systemd user manager is not reachable, or systemctl --user show -p FragmentPath says systemd loads one of the units from another file, such as one in ~/.config/systemd/user.control. drawbar uninstall disables the timers before it removes the unit files, and leaves running a timer systemd loads from another file. When systemctl fails, it keeps the files, along with the links and the binary their services run, reports the error, and removes them all on the next uninstall. DRAWBAR_SYSTEMCTL names a systemctl other than the one on PATH. See ADR 0009.