我有一个使用sbt run"运行良好的 SBT scala 应用程序.但是,这会锁定控制台,我宁愿将其作为服务/守护程序启动,以便我可以使用控制台,也可以将其添加到 init.d 以确保我的应用程序在启动时自动启动.
I have an SBT scala application that runs fine using "sbt run". However, this locks up the console, and I'd rather start it as a service/daemon so that I can use the console, and also so that I can add it to init.d to ensure that my application is started automatically on startup.
我似乎找不到办法做到这一点.运行sbt run &"似乎将应用程序挂在后台.
I can't seem to find a way to do this. Running "sbt run &" seems to hang the app in the background.
有人知道怎么做吗?
推荐答案我们一直在 init.d 中使用 SBT 启动测试/演示应用程序:
We launch test/demo apps with SBT in init.d all the time:
#!/bin/sh # test lift web app case "$1" in 'start') cd /home/demouser/wa/HTML5DemoLift231/HTML5demo/ sbt jetty run ;; 'stop') cd /home/demouser/wa/HTML5DemoLift231/HTML5demo/ sbt jetty stop ;; *) echo "Usage: $0 { start | stop }" ;; esac exit 0这很有效 - 我们没有遇到任何问题.不过,非网络应用可能会有所不同.
This just works - we have had no problems with it. It may be different with a non-web app though.
更多推荐
将 SBT 作为守护进程运行
发布评论