Cron Jobs

We often have to setup cron jobs for the websites we develop and generally the look on the client’s face is one of confusion at this weird “web word”. So, we thought it was time to put something together which explains what a cron job is and what they are used for.

What is a Cron Job?

Simply put, a cron job is a “job” or “program” that is run on the server are a specific date / time or in a specified time period e.g. every night at 11pm or every hour, etc. They are responsible for ensuring repetitive tasks on the web server are completed.

** Cron jobs are specific to Linux servers.

Why have a cron job?

There are hundreds of scenarios where cron jobs can be useful, but without going into all of them, here are a few of the common purposes and examples on where and how cron jobs can be used:

  • Backup of particular information – backup of your database that makes a backup file somewhere on the server for future reference.
  • Downloading information from a particular website / IP address. For example, if your website requires information from a particular source, you may require a cron job to run every hour to check if the particular source has changed.
  • Cleanup of data – some websites accumulate data throughout the day. Cron jobs could be useful in summarising the information to avoid redundancy on the server / database. Or, they could be used to clean out a particular section of the database on a daily basis.
  • Notifications / Reminders – some websites require notifications to their subscribers to be sent out every month or every day. Or, in some cases, reminders need to be sent about a particular payment due – crons can do that for you and send out mails when they are required.

Who creates a cron job?

Cron jobs should be setup by your web agency. Generally the following will need to be done by your web company:

  • A script will need to be setup that is uploaded to the server
  • The hosting company will need to be contacted by the web developer to setup the cron and specify it’s time intervals. In some cases, the web developer can manually setup the cron job via the website’s control panel area.
  • The cron will need to be tested and monitored and any issues will need to be sorted out by the web developer.

How do I know if I need a cron job?

Your web agency will guide you with this or may not even tell you. Cron jobs form part of the development process, so leave it up to the technical guys to sort it out.

Where a database is required, a cron job is often required to ensure the database is kept up to date and clear of redundant information.