实例1:每1分钟请求一次url
* * * * * /usr/bin/curl https://baidu.com
实例2:每小时的第3和第15分钟执行
3,15 * * * * myCommand
实例3:每晚的21:30重启smb
30 21 * * * /etc/init.d/smb restart
实例4:每周六、周日的1 : 10重启nginx
10 1 * * 6,0 nginx-restart
编辑定时任务
crontab -e
查看定时任务
crontab -l
删除定时任务
crontab -r
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed
crontab -e