多主機下同一命令 - Linux

Frederic avatar
By Frederic
at 2010-02-10T21:45

Table of Contents


多主機下同一命令

有一強者寫了個叫 dssh 的shell script


http://bashcurescancer.com/dssh-executing-an-arbitrary-command-in-parallel-on-an-arb
itrary-number-of-hosts.html


不過我認為下面這樣比較簡單
缺點是不能有其它參數,等我會寫之後再改進好了
------------------- 指令
list='virtue@::1 [email protected]'
dssh(){ for i in $list;do echo $i\:;ssh $i $1;done;}
dssh uptime
------------------- 結果
virtue@::1:
21:33:43 up 23:03, 0 users, load average: 0.54, 0.42, 0.64
[email protected]:
9:36PM up 8 days, 8:58, 0 users, load averages: 2.00, 2.02, 2.00

--
Tags: Linux

All Comments

Sarah avatar
By Sarah
at 2010-02-15T07:06
用 omnitty 或是 pdsh 也是個方法
Mary avatar
By Mary
at 2010-02-19T21:57
期待您的作品

掛載硬碟權限

Tristan Cohan avatar
By Tristan Cohan
at 2010-02-10T20:54
安裝ubuntu的時候 我把另外一個分割掛在/home/data 結果不知道為什麼, 只要是在這個目錄下的動作 像是mkdir , vim xxx 他都會說權限不足, 需要用sudo 才可以完成動作 請問我要怎麼設定 才可以不需要每次都要輸入sudo呢? -- 最難的兩件事: ...

debian 的 unstable/testing/stable

Agnes avatar
By Agnes
at 2010-02-10T19:31
※ 引述《pgychen (pp)》之銘言: : debian 有分三種板本 unstable testing stable 其實還有experimental : 兩種版本套件的版本數目竟然幾乎相同, 所以 unstable 和 testing 還有差別嗎? : 我猜想目前 : ( unstable 幾乎等 ...

請問Ubuntu與CIC軟體的支援度

Margaret avatar
By Margaret
at 2010-02-10T19:27
※ 引述《bullfrogtwn (牛蛙)》之銘言: : ※ 引述《chenyen ()》之銘言: : : 我是使用Debian : 我是用 gentoo 64 bits : : 跟Ubuntu的狀況應該類似 : : 給你幾個建議: : : 不知道你安裝的軟體是哪些方面的 : : 若只是Cadence、Men ...

debian 的 unstable/testing/stable

Aaliyah avatar
By Aaliyah
at 2010-02-10T19:22
debian 有分三種板本 unstable testing stable 一直以來, 我都認為是三種版本 今天看了 distrowatch.com http://distrowatch.com/table.php?distribution=debian 突然發現 unstable 和 testing ...

ifconfig tun0 down 無效?

Emma avatar
By Emma
at 2010-02-10T15:41
sudo ifconfig tun1 down 如果關不掉的話會顯示個訊息給你吧? 把訊息貼上來給大家幫你看看~ ※ 引述《tonytonyjan.bbsatbbs.cs.nctu.edu.tw (南洋大兜蟲)》之銘言: : 事情是這樣的... : 我家裡用ADSL : 不小心 ppp -ddial ...