2012-03-29 83 views
2

在slave操作系統中遇到slave:start/2的問題,所以我必須在erlang shell中嘗試另一個方向「自動啓動os:cmd的公共節點」。在erlang shell中啓動公共節點

一種方法是直接通過命令,另一種方式是通過bash文件。但是這兩種方式都面臨同樣的問題。如果不能自動啓動,我必須每次手動啓動節點。

Eshell V5.9 (abort with ^G) 
([email protected])1> os:cmd("erl -name abcd"). 
"Eshell V5.9 (abort with ^G)\n([email protected])1> *** Terminating erlang ('[email protected]')\n" 
([email protected])3> os:cmd("~/Documents/Project/node_start"). 
"Eshell V5.9 (abort with ^G)\n([email protected])1> *** Terminating erlang ('[email protected]')\n" 

bash的文件內容如下:

#/bin/sh 
erl -name abc 

回答

2

不,我真的很喜歡這種做法,但作出上述工作,你應該通過「分離」參數設置爲「 ERL」命令:

erl -name foo 

1> os:cmd("erl -name bar -detached"). 
[] 

2> net_adm:ping('[email protected]'). 
pong 

3> nodes(). 
['[email protected]'] 

doc讀:

-detached

啓動從系統控制檯分離的Erlang運行時系統。用於運行守護進程和後臺進程。意味着 -noinput。

+0

非常感謝。 – 2012-03-29 09:25:40