【发布时间】:2017-03-31 19:51:52
【问题描述】:
#/bin/zsh
servers=('10.138.0.8' '10.138.0.91')
for srv in $servers; do
echo "Checking health for " $srv
echo "=========================================="
echo mntr | nc $srv 2181
done
当我执行时,我没有循环超过第二个值10.138.0.91,如下所示
[devops@devops]~% ./healthcheck/zookeeper.sh
Checking health for 10.138.0.8
==========================================
zk_version 3.4.10-39d3a4f269333c922ed3db283be479f9deacaa0f, built on 03/23/2017 10:13 GMT
zk_avg_latency 0
zk_max_latency 0
zk_min_latency 0
zk_packets_received 9
zk_packets_sent 8
zk_num_alive_connections 1
zk_outstanding_requests 0
zk_server_state follower
zk_znode_count 4
zk_watch_count 0
zk_ephemerals_count 0
zk_approximate_data_size 27
zk_open_file_descriptor_count 28
zk_max_file_descriptor_count 4096
为什么?
【问题讨论】:
标签: shell unix scripting zsh shebang