The linux timed task accesses the url instance
- 2020-06-12 11:35:23
- OfStack
The success of linux timed task setting is also a small milestone in linux learning. :) scatter flower scatter flower ~ ~ ~
The following operations are all operated under ubuntu, and the pro test is effective. For other linux systems, please check dear friends by yourself. Take a bow!
1. Enter the compilation state of crontab file:
crontab -e
2, first write crontab file into the interface, the system will be prompted to select the corresponding editor, 1, we can choose vi editor: choose/usr bin/vim tiny
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
If it is not the first time to enter, but your editor is not vi editor, directly enter shell command line:
select-editor
You can reselect it
3. After entering the editor, press "i" to enter the edit mode. In the edit mode, we write down the script we need to access this time:
* * * * * /usr/bin/curl http:// www.xxx.com
The five asterisks here respectively represent the minute, hour, day, month and week. The following url link can be replaced with the corresponding link.
4. After typing, click "Esc", then click ":" and then type again
wq
, you can save and exit
5. Restart the crontab service after saving:
sudo service cron restart
6. Check the establishment of successful timing tasks:
crontab -l
You can see the timed task under the current user
7. Delete timed tasks:
crontab -r
Press enter and type again from the command line:
crontab -l
, prompt: "no crontab for admin"