如何在OpsWorks中运行独立程序?

时间:2021-02-15 09:24:23

I'm sure there's a simple answer. Our program is an executable jar file, and we have a shell script wrapper for it.

我确信这是一个简单的答案。我们的程序是一个可执行的jar文件,我们有一个shell脚本包装器。

  • OpsWorks grabs the distribution zip file from S3
  • OpsWorks从S3获取分发zip文件
  • We're trying to unzip that and run the script file located in bin/run_server.sh
  • 我们试图解压缩并运行位于bin / run_server.sh中的脚本文件

I'm currently down the path of writing a custom deploy recipe for it, running on a layer of type "Other".

我目前正在为它编写自定义部署配方,在“其他”类型的层上运行。

Here is my attempt :

这是我的尝试:

include_recipe 'deploy'

node[:deploy].each do |application, deploy|

    # assume the zip file has been extracted at this point, 
    # and the CWD is the extracted contents
    execute "run the server" do
        command 'bash bin/run_server.sh'
        action :run
    end
end

This fails claiming that it cannot find bin/run_server.sh.

这无法声称无法找到bin / run_server.sh。

Thanks in advance.

提前致谢。

1 个解决方案

#1


0  

Have you tried setting cwd explicitly?

您是否尝试过明确设置cwd?

execute "run the server" do
    command 'bash bin/run_server.sh'
    cwd "/path/to/your/stuff"
end

#1


0  

Have you tried setting cwd explicitly?

您是否尝试过明确设置cwd?

execute "run the server" do
    command 'bash bin/run_server.sh'
    cwd "/path/to/your/stuff"
end