代码

#!/bin/sh
. /etc/init.d/functions
if [ $# -ne 1 ];then
    echo "sh $0 arg0"
    exit 1
fi
for ip in 172.23.216.86  172.23.216.87
#for ip  in 172.23.216.87 
do
    scp -r -p $1 oldboy888@$ip:~ >/dev/null 2>&1   #打印输出到空,错误输出到空
    if [ $? -eq 0 ];then
       action "scp is ok" /bin/true
    else
       action "scp is no" /bin/false
    fi
done

效果

SSH KEY 批量分发

 

相关文章:

  • 2021-11-27
  • 2022-02-17
  • 2021-10-04
  • 2022-12-23
  • 2021-10-27
  • 2021-09-27
  • 2022-03-05
猜你喜欢
  • 2022-01-18
  • 2021-12-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案