宝塔的计划任务的执行周期最低为每分钟,分钟的值不支持小数点,但是有时需要秒数的定时执行。1. 添加计划任务,任务类型选择”Shell脚本”,执行周期选择N分钟,分钟值可以临时填写。
2. 脚本内容添加,以下脚本。#!/bin/bashPATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/binexport PATHstep=3for (( i = 0; i < 60; i=(i+step) )); docurl -sS –connect-timeout 10 -m 60 ‘http://www.baidu.com/‘echo “—————————————————————————-“endDate=`date +”%Y-%m-%d %H:%M:%S”`echo “★[$endDate] Successful”echo “—————————————————————————-“sleep $stepdoneexit 03. 以上step为秒数,上面为3秒,可以随便设置,添加后点击“执行“。
Hi, this is a comment.
To get started with moderating, editing, and deleting comments, please visit the Comments screen in the dashboard.
Commenter avatars come from Gravatar.