1. The command to set the scheduled task is CRONTAB-E
When you use crontab for the first time, you will be asked to choose the editing tools to see people's preferences. Select one. If you want to change the default editing tool later, you can follow the prompts below to run the command "Select-editor" to make your selection.
Select an editor. To change later, run ' Select-editor '.
1./bin/ed
2./bin/nano <----easiest
3./usr/bin/vim.tiny
Choose 1-3 [2]: 3
And then it's crontab-e. After this command executes, the command line enters edit mode and can be set as prompted
The following example sets the echo "hello/n" >>/home/mingyuan/hello.txt this command executes every minute.
The asterisk denotes the meaning of "every", and if you do not use an asterisk, the 1 is the 1-minute time to execute the command. Like 2:1.
# m H Dom Mon Dow command
*/1 * * * * echo "hello/n" >>/home/mingyuan/hello.txt
It is also important to note that if you let crontab execute the script, you also need to take into account the problem of the path, it is recommended to use the absolute path in the configuration file, or you can add Cd/path/to/shell at the beginning of the command, this sentence, the current directory is switched to the directory where the shell, This is consistent with your command line switch to the directory where the shell script is executed. Otherwise, there is a good chance that a file could not be found. earnestly http://blog.csdn.net/telnetor/article/details/5555358
Linux crontab perform tasks on a timed basis