如何通过Mongooseim中的终端与已经运行的实例进行交互?

时间:2019-01-28 18:22:09

标签: erlang ejabberd mongoose-im

我正在从ubuntu服务器上的源代码使用Mongooseim 3.2.0。以下是关注点:

  1. 将mongooseim作为服务运行以使其在mongooseim崩溃或系统重新启动时自动重新启动的最佳方法是什么?
  2. 如何通过终端与ubuntu服务器上已运行的mongooseim实例进行交互,例如“ mongooseimctl live”。我的猜测是运行“ mongooseimctl live”会尝试创建另一个实例。我只想查看实时日志和交互,并且不想为此目的一直滚动长日志文件。

很抱歉,以上答案很明显,但只想遵循最佳指导。

1 个答案:

答案 0 :(得分:1)

mongooseimctl livemongooseimctl foreground对于开发或烟雾测试部署最有用(除非您在容器中运行)。对于现实情况,您应该在后台使用mongooseimctl start启动服务器。

回到容器-容器化应用程序的最佳方法是在前台运行它们,因此在容器启动脚本中使用mongooseimctl foreground

一旦服务器运行(无论如何启动),都可以使用mongooseimctl debug来附加外壳以解决问题。这是您收到Protocol 'inet_tcp': the name mongooseim@localhost seems to be in use by another Erlang node错误时要使用的命令。如果是生产环境,请小心-您可以通过访问此Shell轻松关闭服务器。

如果您只想查看日志,而无需交互访问shell提供的服务器内部组件,那么简单的tail -f /your-configured-mongooseim-log-dir/*就足够了。


如今,Ubuntu使用systemd来管理其服务的生命周期。可以在https://github.com/esl/MongooseIM/blob/master/tools/pkg/platforms/debian_stretch/files/build/mongooseim.service处找到系统化的.service文件-我们将其用于打包为Debian / Ubuntu .deb软件包。

相关问题