- -o /dev/null 屏蔽原有输出信息
- -s silent
- -w %{http_code} 控制额外输出
- -I 仅测试HTTP头
- -m 10 最多查询10s
#!/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})