Skip to content

What are Cron Jobs and Why Should You Care

Some scripts for your website will require programs to be run at certain intervals. There are two ways to do this. The first is to log onto your website and run the process yourself every time it needs to be run. However if you don’t have the time to do this (and most people don’t), the scripts can be automatically run using a set of cron jobs.

Cron jobs are part of a server program most web hosts have installed. In order to understand what a cron job does, you first have to understand how a server-side script works. A server-side script (such as a PHP script) is not run on the client (website visitor’s) computer; it is run on the server. All the server needs is a user to access the script’s file and then the server will make that program run. If nobody is viewing the script, the job is not preformed. Cron jobs were made to step in and run scripts without someone having to manually view them. Since the server’s cron program runs constantly, a cron job can be set by a user to run at any interval, and that script can be initiated automaticalA2 Hostingly.

But what kinds of scripts would have to be run while nobody is accessing the web site? Well, anti-spam programs for one. Sometimes, these programs can take a long time to check for spam due to the mass amount of data it must compare a user’s input to. It could be annoying if the user had to wait for this process to happen before their page was loaded, especially if they had to go through it multiple times. What can happen though is a cron job could be set up to check for and delete spam every few minutes. Cron jobs are a little more patient in waiting for larger programs to run, and can make your visitors have a better experience using your site.

Another popular choice among webmasters is to let cron jobs automatically talk to other sites. Let’s say that you ran a blog, and every time a visitor posted a comment it was automatically updated to Twitter. If Twitter is taking a little while to respond, but your server is running as fast as ever, the visitor will still have to wait. Using a cron job to automatically post comments to Twitter would probably cut the visitor’s wait time in half.

So as you can see from the above facts, cron jobs are something you should care about. Many webmasters that don’t run advanced scripts won’t have to worry about them. But in case you were ever interested in upgrading your website to have more features, it’s always nice to know they’re there.

Back To Top

Pin It on Pinterest