开发者

Starting two mochiweb servers with a single script file

开发者 https://www.devze.com 2022-12-17 04:21 出处:网络
I have a basic web server that I generated from the mochiweb framework. To start it I use the start.sh script that the framework automatically generates. Everything works fine and the server starts up

I have a basic web server that I generated from the mochiweb framework. To start it I use the start.sh script that the framework automatically generates. Everything works fine and the server starts up. Now I have one more mochiweb server that I want to start along with the first one. Again, this starts up perfectly standalone with its start.sh script.

So what I di开发者_如何学运维d was create a script calling the start scripts of both the mochiweb servers from this script as background processes, something like:

serverOne/start.sh &
serverTwo/start.sh &

When I run the script, both servers seem to start normally, but immediately after they start, they seem to receive an EXIT signal and they shutdown. I have a feeling this is due to the operating system (ubuntu) terminating the processes that the main script file spawns to run the two start scripts. Or could there be any other reason? What should I do to solve this? How do I start the two servers with a single script file?

Right now the script file quits with the last line saying:

(nodeServer1@MyServ)1> *** Terminating erlang (nodeServer1@MyServ)
 .
 .
 .
(nodeServer2@MyServ)1> *** Terminating erlang (nodeServer2@MyServ)


Got it working!

I added a -noshell argument to the start script that was generated by the mochiweb framework. And now I'm able to run both the start scripts from another script without issues. The problem earlier was I guess that it started the erl shell which was terminated as soon as the web server was started eventually shutting down the mochiweb server also.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号