千家信息网

shell脚本(查看多台服务器端口)

发表于:2024-10-22 作者:千家信息网编辑
千家信息网最后更新 2024年10月22日,【xcall.sh】#!/bin/bashparams=$@hosts=`cat /soft/hadoop/etc/hadoop/slaves`tput setaf 2echo ===========
千家信息网最后更新 2024年10月22日shell脚本(查看多台服务器端口)


【xcall.sh】

#!/bin/bash

params=$@

hosts=`cat /soft/hadoop/etc/hadoop/slaves`

tput setaf 2

echo =============localhost==================

tput setaf 7

$params

for host in $hosts ; do

tput setaf 2

echo =============$host===========================

tput setaf 7

ssh -4 $host "source /etc/profile ; $params"

done


0