借鉴地址:https://blog.csdn.net/liuxin_0725/article/details/79621099
linux crontab 命令,最小的执行时间是一分钟。如需要在小于一分钟内重复执行,可以有方法实现。
1:编写shell脚本实现 推荐
crontab.sh
#!/bin/bash
step=2 #间隔的秒数,不能大于60
for (( i = 0; i < 60; i=(i+step) )); do
wget -P /home/download/ -q https://zlc.com/Salesapi/Admintimes/index
sleep $step
done
exit 0
原理:在sh使用for语句实现循环指定秒数执行。
2:脚本执行的权限 chmod +x crontab.sh
3:crontab -e 输入以下语句,然后:wq 保存退出。
* * * * * /home/yiqiliulilu/crontab.sh