系统 :Ubuntu
1.检查cron服务的状态
service cron status
- 启动 cron
sudo service cron start
3.vi run_on_friday_hourly.sh
**# 检查是否为周4**
if [ "$(date +%u)" -eq 4 ] ; then
echo "ok" >> /home/gdz/gdz/1.txt
fi
4.crontab -e
选择编辑器
select-editor
一分钟执行一次
* * * * * /home/gdz/gdz/run_on_friday_hourly.sh
执行频率 :
-
-
-
-
- command to be executed
-
-
-
| | | | |
| | | | ±— day of week (0 - 7) (Sunday=0 or 7)
| | | ±------ month (1 - 12)
| | ±-------- day of month (1 - 31)
| ±---------- hour (0 - 23)
±------------ min (0 - 59)