What is a cron job

  • Home What is a cron job
What is a cron job

What is a cron job

July 25, 2022

What is a cron job?

It’s commonly used for automating tasks that run in the background at specific times such as scheduled backups, monitoring disk space, managing system maintenance tasks, freeing drive space from useless files, sending bulk emails, and much more. All these different scheduled tasks (or jobs) are known as cron jobs.

Cron is essentially a daemon (a computer program that runs as a background process serving various purposes) that detects and executes cron jobs at specified dates and times whether it’s a one-time or recurring task. It runs every minute during which it inspects a set of pre-defined directories in your file system to determine whether cron jobs require to be run.

To run a cron job, three components need to be present including a specific command or a script that’s to be executed, a command that executes the script on a specific time basis (usually set in your control panel), and an action or an output of the script that would depend on what’s the script in question does.

Cron jobs can be scheduled to run multiple times a day or to run at specific hours and minutes on specific days and months. To do this you’ll be using crontabs, which is a list of commands OS uses to let you schedule all sorts of tasks that’ll be executed by cron expressions at the pre-set timing.

We should note that most scripts that use a cron job will come with specific how-tos, so you’ll know what needs to be set up and how.

cPanel is the most popular Linux-based graphical user interface (GUI) out there and it will simplify the tedious tasks of managing and monitoring all aspects of your website or websites. So, if you have the pleasure of utilizing this user-friendly control panel, this is how you can set up a cron job with it.

First, let’s get started by logging into your cPanel. Once you’re in the cPanel dashboard, scroll down to the “Advanced” section, search for “Cron Jobs” and click on the icon.

This will take you to the cron job interface where you can input your e-mail address so that the cron utility can send you e-mails every time one of the cron jobs produces an output – it’s a simple way to keep track of every job and review potential errors.

After this, you’ll want to scroll down to the “Common Settings” section and configure specifications about the cron jobs you want to add. Here you can pick the schedule you want a cron job to run on – once per minute, once per five minutes, once per hour, and so forth.

Once the schedule is chosen, the text box below will be filled out automatically, but you can alter it to match your needs.

At last, enter the command you want the system to run in the “Command” section, tap into “Add New Cron Job” and congratulations, you’ve set up a cron job.

Plesk is a web hosting platform with a control panel that allows the administrator to set up websites, email accounts, DNS, and databases through a web browser.

While Plesk and cPanel serve the same purpose, they differ when it comes to GUI and the servers they support. cPanel’s intuitive interface is more user-friendly but the web-based control panel is compatible with Linux servers only. On the other hand, Plesk supports both Windows and Linux servers.  

Much the same as with cPanel, to set up a cron job using Plesk you’ll need to log in and click on the “Scheduled Tasks” button on the right section of the dashboard.

There you’ll see an option to add, remove, and refresh tasks, but also a “Setting” section you’ll want to visit first and set a correct time zone. After this, click on “Add Task” and add any specification about the cron job you want to run including time intervals, notifications, and a description, and enter the actual command. That’s it, the cron job has been set up.

The only slight difference between setting cron jobs using cPanel and Plesk is that with the latter one the icon doesn’t say “cron jobs”.

My Take: This is very useful and flexible, programmers should know how to do this.

SOURCE: techradar.com

To Make a Request For Further Information

5K

Happy Clients

12,800+

Cups Of Coffee

5K

Finished Projects

72+

Awards
TESTIMONIALS

What Our Clients

Are Saying About Us

Get a

Free Consultation


LATEST ARTICLES

See Our Latest

Blog Posts

Intuit Mailchimp