Cron Job

Cron is time based job scheduler. It enables the users to schedule jobs to run periodically at certain times or dates. Cron is driven by a crontab or cron table file. But what is a crontab file. Anybody know it? Actually crontab file is a configuration file that specifies shell commands (A Unix shell is a command-line interpreter or shell that provides a traditional user interface for the UNIX operating system and for Unix-like systems) to run periodically on a given schedule.

What is a Crontab?

‘Cron tab (CRON TABLE)’ is a text file that contains a series of cron functions. The crontab files are stored where the lists of jobs and other instructions to the cron daemon are kept. Users can have their own individual crontab files and often there is a system wide crontab file which only system administrators can edit. Each line of a crontab file represents a job and is composed of a CRON expression, followed by a shell command to execute.

For most cron jobs, there are three components present:
1. The script that is to be called or to be executed.
2. The command that executes the script on a reoccurring basis. This is typically set in the cPanel.
3. The action or output of the script, which depends on what the script being called, does. Frequently, scripts called as a cron job modify files or databases; however they can perform other tasks that do not modify data on the server, like sending out email notifications.

How Cron tab helps us?

If you want to send your email sources to your subscribers, you can set the cron job on your server. And your cron manager sends the one email every day at the set time until all the emails will be finished. If you want to send them on Sundays, you can schedule it with your cron. You can schedule it to delete your website members with expired accounts. Also You can schedule it to receive an update on your subscribers from your mailing list manager.
As a matter of fact A cron job is set up with cron tabs within a cron tab manager.

Cron tabs are divided into six fields: minutes, hours, days, months, weekdays, and commands. Moreover The command field provides instructions to the computer. The minute field runs from 0-59 and gives the exact minute the command is to be executed. In fact The hour is set between 0-23, with zero representing midnight. The days of the week run from 0-7, with both 0 and 7 representing Sunday. Commas are used when adding a list, while asterisks are added where the user does not wish to specify a field. Once the text is created for the cron job, it is followed by a .txt extension, such as Cron.txt. Then, the job is uploaded and the text file’s accompanying command would read as “crontab cron.txt” before it takes effect on the web page.

0

Leave a Reply

Your email address will not be published. Required fields are marked *
You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>