curl获取HTTP返回状态码
2021-01-29 06:16
标签:max store location nfs www res bin 屏蔽 输出 curl获取HTTP返回状态码 标签:max store location nfs www res bin 屏蔽 输出 原文地址:https://www.cnblogs.com/zendwang/p/shell-curl-return-http-status-code.html
#!/bin/bash
status_code=curl -I -m 10 -o /dev/null -s -w %{http_code} www.baidu.com
#!/bin/bash
status_code=$(curl -H "Content-Type: application/json" -o /dev/null -s -w %{htt
p_code} -XPUT -d ‘
{
"type": "fs",
"settings": {
"location": "‘${NFS_DIR}‘/‘${REPO_DIR}‘",
"max_snapshot_bytes_per_sec": "50mb",
"max_restore_bytes_per_sec": "50mb"
}
}‘ ${ES_URL}/_snapshot/${REPO_DIR})
上一篇:jQuery方法(1)