how to run a java program at background from chef recipe -
i chef rookie. want create recipe run jar @ background.
bash 'run_jar' code <<-eoh wget https://github.com/kiwiwin/jar-repo/releases/download/kiwi/helloworld-1.0.jar -o hello.jar java -jar hello.jar & eoh end
the helloworld-1.0.jar program first print "hello world", execute while(true) loop.
i expect when login chef-client machine. should indicate there jar running using "jps" command. there no such jar running.
and can see hello.jar downloaded indicates code block has been executed already.
what's wrong recipe?
you best advised configure code run service. several wrappers available, example:
once done can configure chef manage new service:
service "myapp_service" supports :status => true, :restart => true start_command "/usr/lib/myapp/bin/myapp start" restart_command "/usr/lib/myapp/bin/myapp restart" status_command "/usr/lib/myapp/bin/myapp status" action [ :enable, :start ] end
Comments
Post a Comment