1、cron配置文件位置
- /var/spool/cron存放的是所有用户的crontab任务,每个任务以创建者的名字命名
- /etc/crontab文件负责调度各种管理和维护任务
- /etc/cron.d目录存放任何要执行的crontab文件或脚本
- /etc/cron.hourly、/etc/cron.daily、/etc/cron.weekly、/etc/cron.monthly目录中,分别让任务一小时、一天、一周、一月执行一次
2、crontab语法和表达式
minute hour day-of-month month-of-year day-of-week command
0-59 0-23 1-31 1-12 0-6 command / script
crontab -e
crontab -l
crontab -u admin -e
crontab -u admin -l
0 01,20 * * * xx.sh >dev/null 2>&1
*/30 * * * * xx.sh
0 22 * * wed,sun xx.sh
0 22 * jun,dec * xx.sh
*/30 * * * * xx.sh && zz.sh && yy.sh