【发布时间】:2019-01-21 23:55:12
【问题描述】:
checkServer(){
response=$(curl --connect-timeout 10 --write-out %{http_code} --silent --output /dev/null localhost:8080/patuna/servicecheck)
if [ "$response" = "200" ];
then echo "`date --rfc-3339=seconds` - Server is healthy, up and running"
return 0
else
echo "`date --rfc-3339=seconds` - Server is not healthy(response code - $response ), server is going to restrat"
startTomcat
fi
}
在这里我想使 curl 命令超时,但它不起作用。在 centos7 Shell 脚本中。我只需要让 curl 命令超时 错误代码是 curl: option --connect-timeout=: is unknown
【问题讨论】:
-
Shell 是一种编程语言。我认为 StackOverflow 或 Super User 或 Unix & Linux Stack Exchange 都适合提问。
标签: linux shell curl timeout sh