在同一目录建立IPMI列表文件ipmi.txt,然后执行:sh sntoip.sh ipmi.txt

    1. #!/bin/bash
    2. user=prom
    3. passwd=Linux@web7
    4. while read line
    5. do
    6. serial=$(ipmitool -H $line -I lanplus -U $user -P $passwd fru | grep "Product Serial")
    7. prom=$(ipmitool -H $line -I lanplus -U $user -P $passwd user list | grep "prom" )
    8. yunwei=$(ipmitool -H $line -I lanplus -U $user -P $passwd user list | grep "yunwei" )
    9. admin=$(ipmitool -H $line -I lanplus -U $user -P $passwd user list | grep "admin" )
    10. echo $line $serial
    11. #echo $prom
    12. #echo $yunwei
    13. #echo $admin
    14. done <$1