DBMASTERCHECK=$(ssh db0.dev.ng.keepit.com "sudo crm_mon -Afr -1|awk '/Masters:/ {print\$3}'")
echo "DB Master is: ${DBMASTERCHECK}"
STBY=$(ssh db0.dev.ng.keepit.com) sudo crm node show $(hostname) | awk '/standby/ {gsub("standby=","");print$2}'
echo "STBY is: ${STBY}"
脚本输出:
DB Master is: db0
Connection to db0.dev.ng.keepit.com closed.
123: line 5: sudo crm node: command not found
STBY is:
看起来它已连接到db服务器,但随后却无济于事
答案 0 :(得分:0)
在不确切知道您在做什么的情况下,没有评论这是否是正确的方法:
STBY=$(ssh db0.dev.ng.keepit.com) sudo crm node show $(hostname) | awk '/standby/ {gsub("standby=","");print$2}'
应该是:
STBY=$(ssh db0.dev.ng.keepit.com sudo crm node show $(hostname) | awk '/standby/ {gsub("standby=","");print$2}')
(结尾)
在错误的位置)。