CentOS 使用 Cron定时服务
- 查看cron服务启动状态
systemctl status crond
- 启动cron服务
systemctl restart crond
- 编辑要执行命令
crontab -e
# 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,$
# | | | | |
# * * * * * user-name command to be executed
例:
每分钟检查一次
*/1 * * * * bash /home/check.sh
在每天5点的时候,每10分钟执行一次