I will cover some of the more common uses for cron, including how scripts can be scheduled, as well as adding new jobs for automation of server administration tasks. Cron jobs may sound intimidating at first, but after running some of them with different scripts, you will see they are a valuable tool for system administrators, and they can accomplish many functions for web sites and web applications. Cron jobs are important because they automate tasks, which cuts down on manual operations, helping to improve security, performance, and features for an admin as well as for all users on a server or site.
While the scripts called Cron jobs will alter files or databases, they are also capable of performing other tasks that do not alter data on the server. You can use Cron when you want to automate certain repetitive tasks on the server, which will eventually save you time.
Now that you know how to configure and execute a cron job within cPanel, you can add the repeating tasks you would like to monitor under a custom schedule. Creating a scheduled task (cron job) is the easiest way to make sure that your scripts are running at certain times, with no additional actions required from you. If you are on a dedicated server, and know which cron jobs are running, it is fine to use these shared times as all system resources will be devoted exclusively to your website or app.
For example, a cron job of 0 0 1 1* runs commands that tell the cron job to execute a command once per year on midnight on January 1, regardless if that is Monday, Tuesday, or any day of the week. Using the cron expression allows you to specify the schedule of a command or script that you want to execute on a periodic basis. Choose when your cron would be running from the minutes, hours, days, months, and weekdays dropdowns. When setting time, it is also best to configure the cron to start at an odd-numbered minute rather than at the top or bottom of the hour.
Once you have got your scripts and cron jobs set up, you will want to add it to your crontab, so that it is scheduled and executed on your server. The easiest way for beginners to create a cron job and add it to the crontab is to use the above example, together with your script, and create a simple text file with all your jobs — each in its own line. The crontab command is used to modify or create the crontab file, list and delete files, and install and remove cron jobs on Vixie Cron.
The files under /var/spool/cron/crontab should not be edited directly, although every user has his or her own crontab files. If no files exist, only superusers are allowed to issue crontab commands, and they alone may create or modify either file. Since Unix-like operating systems support multiple users, every single one can create his own crontab files as well, and launch commands to perform tasks whenever he wants.
You can manage the crontab commands access and define who executes commands using two files: cron.deny and cron.allow. If present, the cron.allow file defines a user that is allowed to create, modify, display, or build crontab files.
Cron allows the administrators of the server to automatically execute scripts known as cron jobs at scheduled intervals. Cron jobs provide commands for scheduling tasks to be executed at fixed times on a periodic basis, helping Webmasters perform repetitive tasks automatically. People setting up and maintaining software environments use the cron utility for the software to schedule jobs to run periodically at fixed times, dates, or intervals.