作为守护进程运行 SBT [英] Running SBT as Daemon

查看:43
本文介绍了作为守护进程运行 SBT的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆