Cron jobs can be very useful to automate repetitive tasks. Users that set up and maintain software environments use cron to schedule jobs (commands or shell scripts) to run periodically at fixed times, dates, or intervals.
Some of the basic examples include running scheduled backups, monitoring disk space, deleting files (for example log files) periodically, running system maintenance tasks and a lot more.
What do you use Cron jobs for?
Latest comments (25)
I use them for monitoring the service and server.
And I also use them to do data exchanging.
At Home:
At work
A few things:
Currently live
In development
And likely a whole load of stuff I've not properly considered yet
I use Ubuntu's native crontab!
Mostly for backing up files, once in code as well where I needed to send notifications at a certain time to certain users.
To execute jobs on queue
Daily scraping for a hobby project (AWS Lambda).
a Github Workflow that checks twice daily for fave'd articles, pulls them into a JSON in the repo for my personal website, then rebuilds the site.
I have setup a cron job in jupyter notebook which periodically sends relevant news articles to various groups.
One of the more 'unconventional' cron jobs I have on one of my systems fires off an Ansible playbook that runs memory compaction and wipes free RAM in all the VM test environments on the system on a nightly basis. This originated back when the system had a very limited amount of RAM and I needed to ensure that none of the VMs used too much over a long period of time, but I've kept it around despite having more than enough RAM now because it actually improves behavior of KSM and THP on the host side, which in turn means the VMs run a bit faster on average.
One of the other interesting ones I have running on one of my systems is used to update the number of CPUs visible to BOINC based on the ambient air temperature in the room (measured using a USB connected thermometer) and the time of day so that the computer doesn't add too much to the thermal load of the HVAC system at times when it might be an issue.
On my own personal Linux computer, I mainly use cron to schedule basic desktop experience things: my desktop background changes every 30 minutes and my window manager's color theme changes to a new one every morning. Besides that, I have a twitter bot I created hooked up to cron that tweets every 6 hours.
Most other system maintenance stuff, like trimming log files and such, are handled by services in systemd.
I have an ETL job that receives files from our multi-value database to sync with our MS SQL server. Crontab triggers the jobs every minute to check for files and if files exist then they get processes.