@@ -179,6 +179,17 @@ OPTIONS
179179 `maintenance.<task>.enabled` configured as `true` are considered.
180180 See the 'TASKS' section for the list of accepted `<task>` values.
181181
182+ --scheduler=auto|crontab|systemd-timer|launchctl|schtasks::
183+ When combined with the `start` subcommand, specify the scheduler
184+ for running the hourly, daily and weekly executions of
185+ `git maintenance run`.
186+ Possible values for `<scheduler>` are `auto`, `crontab`
187+ (POSIX), `systemd-timer` (Linux), `launchctl` (macOS), and
188+ `schtasks` (Windows). When `auto` is specified, the
189+ appropriate platform-specific scheduler is used; on Linux,
190+ `systemd-timer` is used if available, otherwise
191+ `crontab`. Default is `auto`.
192+
182193
183194TROUBLESHOOTING
184195---------------
@@ -277,6 +288,52 @@ schedule to ensure you are executing the correct binaries in your
277288schedule.
278289
279290
291+ BACKGROUND MAINTENANCE ON LINUX SYSTEMD SYSTEMS
292+ -----------------------------------------------
293+
294+ While Linux supports `cron`, depending on the distribution, `cron` may
295+ be an optional package not necessarily installed. On modern Linux
296+ distributions, systemd timers are superseding it.
297+
298+ If user systemd timers are available, they will be used as a replacement
299+ of `cron`.
300+
301+ In this case, `git maintenance start` will create user systemd timer units
302+ and start the timers. The current list of user-scheduled tasks can be found
303+ by running `systemctl --user list-timers`. The timers written by `git
304+ maintenance start` are similar to this:
305+
306+ -----------------------------------------------------------------------
307+ $ systemctl --user list-timers
308+ NEXT LEFT LAST PASSED UNIT ACTIVATES
309+ Thu 2021-04-29 19:00:00 CEST 42min left Thu 2021-04-29 18:00:11 CEST 17min ago git-maintenance@hourly.timer git-maintenance@hourly.service
310+ Fri 2021-04-30 00:00:00 CEST 5h 42min left Thu 2021-04-29 00:00:11 CEST 18h ago git-maintenance@daily.timer git-maintenance@daily.service
311+ Mon 2021-05-03 00:00:00 CEST 3 days left Mon 2021-04-26 00:00:11 CEST 3 days ago git-maintenance@weekly.timer git-maintenance@weekly.service
312+ -----------------------------------------------------------------------
313+
314+ One timer is registered for each `--schedule=<frequency>` option.
315+
316+ The definition of the systemd units can be inspected in the following files:
317+
318+ -----------------------------------------------------------------------
319+ ~/.config/systemd/user/git-maintenance@.timer
320+ ~/.config/systemd/user/git-maintenance@.service
321+ ~/.config/systemd/user/timers.target.wants/git-maintenance@hourly.timer
322+ ~/.config/systemd/user/timers.target.wants/git-maintenance@daily.timer
323+ ~/.config/systemd/user/timers.target.wants/git-maintenance@weekly.timer
324+ -----------------------------------------------------------------------
325+
326+ `git maintenance start` will overwrite these files and start the timer
327+ again with `systemctl --user`, so any customization should be done by
328+ creating a drop-in file, i.e. a `.conf` suffixed file in the
329+ `~/.config/systemd/user/git-maintenance@.service.d` directory.
330+
331+ `git maintenance stop` will stop the user systemd timers and delete
332+ the above mentioned files.
333+
334+ For more details, see `systemd.timer(5)`.
335+
336+
280337BACKGROUND MAINTENANCE ON MACOS SYSTEMS
281338---------------------------------------
282339
0 commit comments