Deploying cron programmaticaly the unix way

NILHere is a little script to automatize in some way your crontab

deployment when you don't want to use a configuration tool like

ansible/salt/puppet etc... This let you package a file in your project

containing the crontab content you need, and it will add/update your

crontab with that file.

The script works this way:

$ ./install_cron crontab_solene

with crontab_solene file being an actual crontab correct, which

could looks like this:

## TAG ##

MAILTO=""

*/5 * * * *  ( cd ~/dev/reed-alert && ecl --load check.lisp )

*/10 * * * * /usr/local/bin/r2e run

1 * * * * vacuumdb -azf -U postgres

## END_TAG ##

Then it will include the file into my current user crontab, the

later with the new version. The script could be easily modified to

support the tag name as parameter, if you have multiple deployments

using the same user on the same machine.

Example:

$ crontab -l

0 * * * * pgrep iridium | xargs renice -n +20

$ ./install_cron crontab_solene

$ crontabl -l 

0 * * * * pgrep iridium | xargs renice -n +20

## TAG ##

MAILTO=""

*/5 * * * *  ( cd ~/dev/reed-alert && ecl --load check.lisp )

*/10 * * * * /usr/local/bin/r2e run

1 * * * * vacuumdb -azf -U postgres

## END_TAG ##

If I add to crontab_solene the line

Proxy Information
Original URL
gemini://perso.pw/blog//articles/crontab-manipulation.gmi
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
135.063897 milliseconds
Gemini-to-HTML Time
0.588875 milliseconds

This content has been proxied by September (ba2dc).