Bash脚本查找给出“内存故障”的硬件信息

问题描述:

我正在尝试编写脚本以查找集群中的硬件信息。我试图运行下面的脚本,并且它抛出了“内存故障”错误。 node.txt文件接受集群中相关节点的名称。 任何人都可以帮忙吗?提前谢谢了!Bash脚本查找给出“内存故障”的硬件信息

#!/bin/bash 
function ping() 
    { 
     ping -c 1 "$host" >> $results 
    } 
function hw_info_cpu() 
    { 
     hwinfo --cpu "$host" >> $results 
    } 
function hw_info_gpu() 
    { 
     hwinfo --gfxcard "$host" >> $results 
    } 
function os_info() 
    { 
     lsb_release -a "$host" >> $results 
    } 

results=res.txt 

while read -r host; do 
    ping "$host $results" 
    hw_info_cpu "$host $results" 
    hw_info_gpu "$host $result" 
    os_info "$host $result" 
done < nodes.txt 

“ping”函数正在递归调用自己。

重命名您的“ping”功能“myping”

+1

或者只是使用'ping命令...'禁用功能查找并迫使外部命令来运行函数中。 – chepner 2014-10-30 13:51:22