The Spaghetti Refactory Established 2015

Bash yourself on a schedule!

To run terminal tasks on a schedule, you have to use something called the “crontab.” It is a file that you edit to include the bash code to run and the times and days to run it.

There are some interesting rules/best practices around editing the crontab.

To start, you have to create a crontab by entering crontab -e. Open and edit it in your favorite editor and save.

If you already have a crontab file that you want to edit, you actually shouldn’t. Rather, get a “copy” of your crontab file by doing crontab -l > new_crontab_copy. Then open the new_crontab_copy in your editor, edit and save.

For either of the above options, “install” your crontab file by giving it to crontab:
crontab my-crontab

(This post won’t be giving any advice on actually writing cron jobs - for that you can check out this Crontab quick reference.)