繁体   English   中英

如何编写Play Framework服务外壳以使其在启动时开始运行

[英]How to write Play Framework service shell to let it start running on startup

我目前正在使用play2.4并使用activator dist activator dist会生成一个启动脚本,并且可以完美运行。 但是我不知道如何在服务器启动时使其运行?

我编写了一个外壳文件,该文件调用了activator dist生成的外壳文件,尽管如果直接调用它也可以,但是它不能作为chkconfig的服务。

我当前的/etc/init.d/ shell文件

#!/bin/sh
# chkconfig: 2345 99 10

PORT=80
APP_DIR=application dir here
APP_SHELL= shell file name here

#{APP_DIR}${APP_SHELL} -Dhttp.port=${PORT}

我在哪里做错了? 还是有更好的方法让播放项目在服务器启动时起作用?

PS我正在使用centos作为服务器。

在这里解释: https : //www.playframework.com/documentation/2.4.x/Production#The-Native-Packager

使用activator dist等效于调用universal:packageBin 因此,在sbt插件中启用enablePlugins(JavaServerAppPackaging) rpm:packageBin应该使用upstart脚本创建一个可安装的rpm软件包。

您可以尝试使用以下脚本: https : //gist.github.com/Technowise/47f71f1b2c128d1f2759d4027341f4dc

如果您始终仅在9000上运行单个服务器,则可以使用HüseyinZengin描述的本机打包程序。 否则,我想您将必须运行上述自定义脚本。

暂无
暂无

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

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