31 lines
535 B
Bash
31 lines
535 B
Bash
#!/bin/bash
|
|
# author:xwang@linx-info.com
|
|
|
|
|
|
my_host=`hostname`
|
|
cur_dir=`pwd`
|
|
cur_date=`date "+%y-%m-%d_%H_%M_%S"`
|
|
Nlst=${HOME}/conf/deliver_hosts_linux.sys
|
|
|
|
|
|
if [ -f $HOME/connect-list ];then
|
|
rm $HOME/connect-list
|
|
fi
|
|
|
|
if [ "$1" != "" ];then
|
|
Nlst=$1
|
|
fi
|
|
|
|
trap 'exit' 2
|
|
for i in `cat $Nlst`
|
|
do
|
|
ping -c 1 -w 1 $i > /dev/null
|
|
if [ $? -gt 0 ];then
|
|
echo "ping $i failed,please check your line.."
|
|
else
|
|
echo "Host:$i"
|
|
ssh $i date 2> /dev/null
|
|
echo $i >> ${HOME}/connect-list
|
|
fi
|
|
done
|