A cron job is an automated program developed for
Unix and Linux systems. It allows the user to execute several commands at a
specific time on a precise date. A cron job is an important tool that can be
used for anything from running scripts and re-indexing a web page to providing
backup for a database. A cron job can also be used as a reminder for
downloading email. The user only needs to set the program up once in order for
it to continuously complete the job.
If a web e-zine owner has over 100 email subscribers
reading his publication on the 25th of each month, for example, a cron job
could assist in getting the information out to each reader at the same time and
date each month. In addition, it can add new members to the web site and remove
those who unsubscribe while maintaining the database.
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. 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. 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. Some older systems, including some Unix systems, use
0 through 6 as the days of the week, 0 being Sunday. White spaces or tabs must
separate each field. Commas are used when adding a list, while asterisks are
added where the user does not wish to specify a field. For the aforementioned
web e-zine owner, for example, the cron job can be set up with an asterisk in
place of the day of the week because the 25th day of the month will not always
fall on the same weekday.
A cron job is written in a text file with a
series of cron commands for the computer to adhere to. Preparing a cron job as
a text file also makes it easier to edit the scripts later if needed. In
addition, the cron job can be set up to either allow or deny certain users from
tweaking the set cron tab. 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.
No comments:
Post a Comment