用for 读取服务器列表,空格间隔
for h in `cat a`; do ssh root@${h} 'chkconfig --level 35 ntpd on && chkconfig --list ntpd && service ntpd status && ntpq -n -p' ;done
#以下命令每读取一行IP地址,如果不执行ssh命令while正常运行,如果执行的是ssh命令,则只有第一个IP地址成功完成ssh命令
cat a | while read ip ; do command ;done
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/8806316/viewspace-1060512/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/8806316/viewspace-1060512/