Cron is a process scheduler which, despite its simplicity, is an extremely versatile tool, applicable in a myriad of different ways, suitable for scheduling jobs at pinpoint times around the clock. That’s why we’ve decided to compile a list of some of Cron’s many uses which we have been lucky enough to witness through our experience with our customers. Hopefully you’ll be inspired to come up with your own creative uses for Cron!
Working Around the Clock
Many companies find themselves using Cron to interact with different companies, vendors, and other parties on a regular basis. Generating and sending routine reports, providing invoices or bills, gathering and processing monthly data from Stripe - all these operations can be automated and scheduled. But Cron isn’t limited to back-end processes. Some companies bring Cron out to the front lines in order to handle the bulk of their daily interactions with customers and providers, even going so far as to use Cron To Go for sending out online lunch and dinner reservations! (Click here to read more about the Story of Potluck)
This one goes out to all Heroku users - Cron definitely comes in handy when scaling dynos up or down to handle the changing load. This is especially true when you factor in business hours - peak hours in which traffic is booming require more Dynos than the dead hours of the night when not much is going on. Cron is one way to allocate Dynos throughout the day, the month or even the year, so that no Dyno goes unused. All you have to do is use the Heroku CLI buildpack in your app, in order to run heroku CLI commands on a schedule.
There is also the matter of restarting Dynos. Heroku automatically restarts Dynos every 24 hours (plus up to 216 random minutes) . However, in some cases, such as bug induced memory bloats, you may want to reboot your Dynos more frequently. Cron could prove to be quite useful for that too.
Busy in the Back End
One of the most popular ways to use Cron is to automate and schedule processes taking place behind the scenes, out of the user’s sight. Removing inactive users or accounts, marking inactive sessions, expiring reservations and coupons, or general management and maintenance of databases like reindexing Elasticsearch indexes and vacuuming Heroku Postgres databases - Cron is distinctly applicable to these kinds of repetitive tasks.
Scheduling Batch Data Processing
Creating and managing a database definitely requires a fair share of time and energy spent on executing routine tasks. These tasks, however, can be automated using a cloud scheduler. The process of identifying and merging duplicate contacts, for example, can be made to happen recurrently and at certain times. Processing customer behaviour to build recommendation engines, or “people you may know” tables, are also composed of repetitive, routine tasks which are exactly the type of tasks best suited to be automated by Cron on the cloud.
Generally speaking, data warehousing tasks tend to suit Cron - data warehousing tasks such as ETL; data cleansing; syncing disparate databases; referential integrity checks and fixes;; fixing real time counters; computing, storing, and running aggregates, the list could go on quite a bit. Furthermore, while the end goal of these tasks is to improve and organize analytics, loading data into data warehouses is a taxing, resource intensive process. With Cron, however, it can be scheduled to take place after business hours so that it does not interrupt one’s daily undertakings.
Cron To Go
All the different uses for Cron which have been mentioned in this post are examples of what customers are doing with Cron To Go, our cloud based Cron as a service. Have any creative uses for Cron just waiting to be heard? Feel free to reach out with any questions or ideas via chat in the bottom-right of the page.