如何在执行命令后保持sbt运行(作为守护进程)

时间:2015-09-12 21:42:02

标签: sbt scalatra

我想从sbt启动scalatra服务器。我怎么做?以下是启动scalatra:

sbt "container:start"

但它会立即退出:

[info] starting server ...
[success] Total time: 2 s, completed Sep 12, 2015 2:39:32 PM
> [info] waiting for server to shut down...

最好的是整个事情都会作为守护进程在nohup中运行。

2 个答案:

答案 0 :(得分:2)

不要在一条线上做。使用两个命令。

./sbt
container:start

答案 1 :(得分:2)

class ProxyServer(rdp.RDPServerObserver):
  def __init__(self, controller, target, clientSecurityLevel, rssRecorder):
    """
    @param controller: {RDPServerController}
    @param target: {tuple(ip, port)}
    @param rssRecorder: {rss.FileRecorder} use to record session
    """
    rdp.RDPServerObserver.__init__(self, controller)
    self._target = target
    self._client = None
    self._rss = rssRecorder
    self._clientSecurityLevel = clientSecurityLevel


  def onReady(self):
    """
    @summary:  Event use to inform state of server stack
                First time this event is called is when human client is connected
                Second time is after color depth nego, because color depth nego
                restart a connection sequence
    @see: rdp.RDPServerObserver.onReady
    """
    if self._client is None:
      # try a connection
      domain, username, password = self._controller.getCredentials()
      self._rss.credentials(username, password, domain, self._controller.getHostname())

      width, height = self._controller.getScreen()
      self._rss.screen(width, height, self._controller.getColorDepth())


      if checkPassword(username, password): #password ok
          reactor.connectTCP('127.0.0.1', 3389, ProxyClientFactory(self, width, height, domain, username, password,self._clientSecurityLevel))
      else:
        pass
        #how to make client re-input username and password in this place

诀窍。请注意,首字母分号