装一个puppet吧。

http://wenku.baidu.com/view/c2fdc4d5360cba1aa811da88.html

<http://wenku.baidu.com/view/c2fdc4d5360cba1aa811da88.html>

2010/11/1 cnhack TNT <[email protected]>

>
> 去年的advent里有这么篇文章:
> http://perlchina.org/advent/2009/SSHBatch.html
>
> <http://perlchina.org/advent/2009/SSHBatch.html>
>
> 2010/11/1 liseen <[email protected]>
>
>> HI
>>
>> 如果你是集群操作, 建议你安装 sshbatch 模块
>> install:
>>       sudo cpan SSH::Batch
>>
>> 那么你就可以使用
>>        atnodes 'sudo ls /tmp' 'host[1-8]'.example.com
>>
>> 如果你的sudo需要终端, 可以使用 -tty 选项, 这个选项要求版本在0.024之上。你如果要使用这个功能可以从github上安装,
>> 或者等一天之后从cpan 上安装。
>>
>>       atnodes -tty 'sudo ls /tmp' 'host[1-8].example.com'
>>
>> liseen
>>
>>
>> 2010/11/1 liseen <[email protected]>
>>
>>  ssh u...@hostname 'sudo ls /tmp'
>>>
>>> 这样直接执行可以吗?
>>>
>>>
>>> 2010/10/30 frostyplanet(plan) <[email protected]>
>>>
>>> expect的缺陷在于需要检测shell提示符,因为提示符会根据使用环境而不同。
>>>> 如果要用expect来登录,最好要给ssh加上 "StrictHostKeyChecking=no" 之类的参数
>>>> 如果能用ssh信任关系来绕过ssh密码这步的话就最好了,
>>>> ssh可以用非交互方式执行命令,具体查看man ssh。
>>>>
>>>> On Oct 29, 9:59 pm, emacs ray <[email protected]> wrote:
>>>> > 我需要登录到一些机器的 sudoer 用户上用 sudo 执行一些命令。
>>>> > 怎么等待远程机器把命令执行完?检测 shell 提示符吗?
>>>>
>>>> --
>>>> 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
>>>> 要向此网上论坛发帖,请发送电子邮件至 [email protected]。
>>>> 要取消订阅此网上论坛,请发送电子邮件至 
>>>> [email protected]<perlchina%[email protected]>
>>>> 。
>>>> 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
>>>>
>>>>
>>>
>>  --
>> 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
>> 要向此网上论坛发帖,请发送电子邮件至 [email protected]。
>> 要取消订阅此网上论坛,请发送电子邮件至 
>> [email protected]<perlchina%[email protected]>
>> 。
>> 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
>>
>
>  --
> 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
> 要向此网上论坛发帖,请发送电子邮件至 [email protected]。
> 要取消订阅此网上论坛,请发送电子邮件至 
> [email protected]<perlchina%[email protected]>
> 。
> 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
>

-- 
您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
要向此网上论坛发帖,请发送电子邮件至 [email protected]。
要取消订阅此网上论坛,请发送电子邮件至 [email protected]。
若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。

回复