简体   繁体   English

如何在后台运行Play的dist文件?

[英]How to run the Play's dist file in the background?

When I deployed my play application I built the package using: 部署播放应用程序时,我使用以下命令构建了程序包:

dist

This created a file that I can run on my server like: 这创建了一个文件,我可以在服务器上运行它,例如:

sudo ./bin/app-name -Dhttp.port=9090

This works fine for testing but how can I run this process in the background? 这对于测试来说效果很好,但是如何在后台运行此过程?

I will eventually have to use upstart or some sort of process monitoring tool to make sure this process is running after server reboots etc. 我最终将不得不使用upstart或某种进程监视工具来确保服务器重启后此进程正在运行。

Using play 2.3.x 使用播放2.3.x

Since you are on ubuntu 因为你在ubuntu上

sudo ./bin/app-name -Dhttp.port=9090 & 

should do the trick. 应该可以。

Ceating the upstart script is also fairly easy https://askubuntu.com/questions/18802/how-to-correctly-add-a-custom-daemon-to-init-d In your case it would be in /etc/init/app-name.conf and look like 创建新贵脚本也很容易https://askubuntu.com/questions/18802/how-to-correctly-add-a-custom-daemon-to-init-d在您的情况下,它位于/ etc / init中/app-name.conf看起来像

# app-name
#   

start on stopped rc RUNLEVEL=[2345]
stop on runlevel [!2345]

respawn
exec $PATH_TO_APP/bin/app-name -Dhttp.port=9090

Of course you will want to change the RUNLEVEL and the PATH_TO_APP 当然,您将需要更改RUNLEVEL和PATH_TO_APP

That of course depends on the system at which you're deploying the app, anyway in general you need to run it as a deamon. 当然,这取决于您部署应用程序的系统,总的来说,您通常需要将其作为守护程序运行。

Refer to your system's documentations, I'm pretty sure that you will find tutorial very soon. 请参阅系统的文档,我很确定您很快就会找到本教程。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM