Managing a user's crontab in a dotfiles repository

281 views Asked by At

Many developers maintain a dotfile repository, keeping all their configurations in a single space that can be easily synced among different machines. What I haven't seen so far is people maintaining their crontabs in the dotfile repository.

Regardless if you find the idea itself useful or not, what would be a convenient way to manage one's crontab in the dotfile repository as well? In my dotfiles repository, the management of the symlinks is handled by GNU Stow and a simple Makefile that wraps the stow-commands like so:

all:
    stow --verbose --target=$$HOME --restow */

delete:
    stow --verbose --target=$$HOME --delete */

GNU Stow obviously will not work for crontabs. How could I integrate the rollout, update and removal of a crontab in this setup?

1

There are 1 answers

0
Benjamin Carlsson On

crontab has a usage of the form:

crontab [-u user] file

which will install a new crontab from some named file. You can place this step in your Makefile and install a file committed to the repository.