将 SBT 作为守护进程运行

编程入门 行业动态 更新时间:2024-10-05 21:21:32
本文介绍了将 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 作为守护进程运行

本文发布于:2023-11-23 22:00:26,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1622966.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:进程   SBT

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!