cat > fenfa_sshkey.sh << EOF
#!/bin/bash
. /etc/rc.d/init.d/functions
[ ! -d /home/gpadmin/.ssh ] && /usr/bin/expect ssh-keygen.exp
for ip in `cat /etc/hosts|grep “17[6-7]”|awk ‘{print \$1}’`
do
/usr/bin/expect fenfa_sshkey.exp /home/gpadmin/.ssh/id_rsa.pub \$ip &>/dev/null
if [ \$? -eq 0 ]
then
action “\$ip is ok” /bin/true
else
action “\$ip is fail” /bin/false
fi
done
EOF