Erlang 裏面使用Remote shell

今天無意中發現這個功能。。。

[url]http://ejabberd.jabber.ru/interconnect-erl-nodes[/url]

在下載的 getting_started-5.0.1.pdf 那裏也有這個topic:《Advanced Shell Usage - Job Control Mode》,不知道爲何官方html格式的文檔那裏消失了 :?

簡單來說是這樣,比如節點 [email protected] 啓動了一個daemon

[quote]erl -name [email protected] -setcookie 123456 -noshell -noinput ...[/quote]

如果要管理它,可以這樣:

[quote]# ./start.sh -name [email protected] -setcookie 123456
Erlang (BEAM) emulator version 5.5.4 [source] [async-threads:0] [hipe] [kernel-poll:false]

Eshell V5.5.4 (abort with ^G)
([email protected])1>
User switch command
--> h
c [nn] - connect to job
i [nn] - interrupt job
k [nn] - kill job
j - list all jobs
s - start local shell
r [node] - start remote shell
q - quit erlang
? | h - this message
--> j
1* {shell,start,[init]}
--> r '[email protected]'
--> j
1 {shell,start,[init]}
2* {'[email protected]',shell,start,[]}
--> c 2
Eshell V5.5.4 (abort with ^G)
([email protected])1> nodes().
['[email protected]'][/quote]

比用什麼rpc的方便多了 :P
btw:在Windows下可以使用werl,這樣就可以使用Ctrl+G了
發佈了3 篇原創文章 · 獲贊 0 · 訪問量 1238
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章