Use crontab script execution timing under Mac

Basic Command Set

In the terminal, enter:
sudo crontab -e

View regular tasks

crontab -l 

To delete a scheduled task

crontab -r 

If you can not use the regular task crontab

Solution:
sudo vim ~/.vimrc

Add the following content and save

autocmd filetype crontab setlocal nobackup nowritebackup

Setting the timing task format

Format (columns per row lines co):
f1 f2 f3 f4 f5 program
Timeshare weeks sun and the moon program execution
 
The first 1 minute to 59 1
2 hours 1 second to 23 (0 represents midnight)
3 Liege 1 to 31
Fourth Retsutsuki 1 to 12
The first five weeks 0 to 6 (0 = Sunday)
Column 6 command to run
 
Every 10 minutes, curl one visit this address
*/10 * * * * curlhttp://localhost/test.php
 
Every Saturday, Sunday 1:10 to restart apache
10 1 * * 6,0 /usr/local/apache/bin/apachectl restart
 
For more details, see the FIG.
 
E.g:
In  sudo crontab -e  added after the code below
# 1- week Week 5 15:10 dinner to execute script
 10  15 * * 1 , 2 , 3 , 4 , 5 Python /Users/root/Desktop/scripts/order_meal.py

Guess you like

Origin www.cnblogs.com/DI-DIAO/p/12588706.html