While I was learning how to code, use github, and set up tasks during University one thing kept popping up. I needed to be able to schedule tasks to run without me being there. I did not want to have to wake up in the middle of the night to check on if my scripts worked and rerun them if need be or constantly pull from my needed repos for projects. Lastly, manually updating my systems was becoming a hassle with the addition of a server rack and several computers.
That is when I found crontab. Cron lets you automate a script then runs it at a given interval. It can even allow you to put into a document if it was sucessful or what the output of the file was. This can include possible errors if something went wrong. Not only is that last part good for debugging, it also helped show when and where the script went wrong. A few things that I automated in the early days were updating each one of the computers that I own and sending that output to a shared drive. As the cronjob works, it updates that output file each time.
From one location, no matter what one of my devices I am using, I can check on the processes and then tweak any scripts if they expirence an error. As the years went on, a few more things that I updated were my github commits. I use github to keep track of my notes through logseq. You can read about it here.
Instead of just having my files available on one computer, this makes it available to pull to any computer. I can take my laptop to class or to meetings where I can take notes and make connections in a very easy to reference way. Then automate through cron a timeframe in which to pull any updates done to the logseq folder, stage them as commits, then push them to the Git repo. Then on my other machines I can set a git pull at intervals to then grab any updates. This results in having notes ready on my home computer from a meeting that I had that day when I get back. This has absolutely helped with organization and planning in the past few years and I hope to continue it into the future.
Without having to pay subscription prices, manage a cloud storage size, or trust my data is 'safe' in the hands of some big corperation, I can do it all securely without spending a penny thanks to cron. To many it is just a simple scheduler but I hope this shows anyone not used to this technology that it can be so much more.
Another thing that I use cron for is a lot more simple then the previous example, morning crosswords. Many newspaper companies publish online crossword puzzles for their subscribers to do in lew of a physical paper. Some of the largest news papers just have these files also ready to pull from their websites. A simple script that runs at 5 am every morning grabs the top 10 or so papers' crosswords that I enjoy and neatly puts them into a folder. I then use a simple program that lets you put in .puz files and BOOM, instant puzzle with breakfast to start your day the right way.
While this looks quick, this is just a part of what the script runs, while it can search dozens of websites and also navigating to the script, running it, waiting for it to load, and then finding the files can be so much time wasted. Just using cron to do it all before I even wake up is so much easier.
The last few things I use cron for would be automatically pulling files for my NAS. By using cron I can pull various ISO files from trusted sites and put them onto my NAS incase I need them in the future. Whether its different flavors of Linux or virtual environment files. All of that can be done and grabbed while I sleep or work on more important tasks.
I also use cron for other small tasks here and there and while I can not link all my cron scripts here, I hope I have shown you the amazing ways to easily automate your life the way I have.
While it is important to know what you are running and how it runs, it is also important to not waste time and spend the time you have as effeciently as possible. Using tools like crontab to do the work for you behind the scenes or while you sleep has been an amazing time saver for me. From projects to notes, crosswords to ISOs, and even late night updates to early morning notifications, I have found great ways to make technology work for me instead of the other way around.