Cron is a task that a daemon uses to perform a trip class for a specified period of time. Each user has a crontab file that allows them to specify what needs to be done and when, in addition, the system has a crontab that allows for regular tasks like alternating logs and updating local data.
Using Cron
With Cron, as long as you add some items to the crontab file, a crontab project details the process and time of execution, such as:
5 3 * * */usr/bin/apt-get update
The first part of the Crontab project describes when the task is performed. It is separated into five regions by space, each with a number, "*", or the appropriate word. In turn, this area describes the "minutes", "Time", "Days of the Month", "month", "weekly", months and weeks can be abbreviated, such as "whose" instead of "Thu" instead of "Thursday". The above example will perform "/usr/bin/apt-get Update" (Cron http://www.aliyun.com/zixun/aggregation/11632.html "") at 03:05 per day 24-hour system) you want to have cron display disturbing messages every 5 minutes on all weekdays, (9 o'clock in the morning to 5 o'clock in the afternoon) please use
*/5 9-17 * * Mon,tue,wed,thur,fri Wall "Are We there verb?"
Or want to remind you of a birthday, in the year of the first month of 10th 9 o'clock in the morning, with:
0 9 your * echo "It's" mother ' s Birthday today! "> ~/readme
To view the contents of the Crontab file today, enter:
Crontab-l
To change this file using the System environment default editor (typically vim), enter: To edit the filename, with the editor specified in your environnement (abound defaults to VIM-: q! is The command to escape without saving if you are stuck and need to read up on it or change your editor), use:
Crontab-e
Ps:vim using the command ": q!" Exit without saving the file. If you're having trouble editing this file and you need to reread the file or change to an editor, you can enter this command. When you close the editor, the new crontab file will be installed. Files edited with the crontab command are saved in/var/spool/cron/crontabs
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.