To open the Crontab task plan:
Select the Crontab file editor to edit the crontab file:
Results:
Select an editor. To change later, run ' Select-editor '.
1./bin/ed
2./bin/nano <----easiest
3./usr/bin/vim.basic
4./usr/bin/vim.tiny
Choose 1-4 [2]: 3 (VIM editor)
Edit crontab File: command:~# crontab-e
The use of this command is relatively straightforward. Direct input
~# CRONTAB-E
An edit window opens, and the first line is prompted with the content format:
# m H Dom Mon Dow command
The specific meaning is: the minute-hour date month-week command , the day of the month (Mon) or the days of the week (h,24-hour) several (m) execution of a command,* denotes any time. For example:
3 * * * */home/meng/hello.sh
is: The hello.sh script under/home/meng/is executed at 03 o'clock every hour.
After saving, according to the following screen prompts to enter Ctrl+x exit, you will be prompted to save, enter Y; prompt for the file name, and a temporary file name, because just test, direct carriage to save.
Note: To restart the cron process after editing is complete:
~#/etc/init.d/cron Restart (not available for Ubuntu)
#sudo Service cron Restart (available with Ubuntu)
Here's a little explanation of the meaning of each line in crontab. Each row in crontab represents a task that is performed on a regular basis and is divided into 6 parts. The first 5 sections indicate when to execute the command, and the last part represents the command to execute. Each part is separated by a space, except that the last part (the command) can use a space inside it, and no space in the other part. The first 5 sections represent: minutes, hours, days, months, and weeks, with the following values for each part:
-
Minutes 0-59
Hours 0-23
Day 1-31
Month 1-12
Week 0-6 0 indicates Sunday
In addition to these fixed values, you can also match the asterisk (*), comma (,), and slash (/) to indicate some other meanings:
Asterisks indicate any value, such as filling in the hour section * for any hour (per hour)
Commas can allow multiple values to be filled in a section, such as filling in minutes with 1,3 for one minute or three minutes
The slash general mate * is used, representing how often, for example in the hour section fill in the */2 representative every two minutes. So there is no difference between */1 and * */2 can be seen as an arbitrary value that can be divisible by 2.
* * * * * # Perform a task every minute
0 * * * * # 0 points per hour to perform a task, such as 6:xx
6,ten * 2 * * # 2 per month, 6 minutes per hour and ten minutes to perform a task
*/3, */ 5 * * * * * every 3 minutes or 5 minutes to perform a task, forexample:0 5,ten:
This article is from the "Mr_computer" blog, make sure to keep this source http://caochun.blog.51cto.com/4497308/1638886
Linux-ubuntu-crontab