linux - 如何编写Play Framework service shell让它在启动时开始运行

标签 linux scala shell playframework

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

我编写了一个 shell 文件,它调用由 activator dist 生成的 shell 文件,虽然如果我直接调用它它可以工作,但它不是 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}

我哪里做错了?或者也许有更好的方法让 Play 项目在服务器启动时工作?

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

最佳答案

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

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

关于linux - 如何编写Play Framework service shell让它在启动时开始运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33029215/

相关文章:

从 jar 中执行类文件时出现 java.lang.ClassNotFoundException

linux - 自动 IP 更改的 Shell 脚本

scala - sbt 0.11.3 : getting latest version of a git plugin

scala - Slick有缓存机制吗?

shell - 如何在 GDB 中运行 .sh(shell 脚本)文件?

php - WKHTMLTOPDF 抛出错误代码 127

linux - 帮助 Unix 中的文件描述符

java - 如何向Dataframe添加一些信息?

linux - 在命令行linux上执行多个命令

linux - 从 tasklet 中 wake_up_interruptible() 是否安全?