Linux 秒级定时任务

秒级定时任务脚本

#!/bin/bash
step=3 #间隔的秒数,不能大于60  

for (( i = 0; i < 60; i=(i+step) )); do 
    `curl https://xxxxx`
   sleep $step
done
exit 0

crontab -e 增加定时任务

*/1 * * * * root `bash 你的脚本位置`

此写法不能使用 sh 执行。

你可能感兴趣的:(Linux 秒级定时任务)