I can't execute java program

96 views
Skip to first unread message

刘松

unread,
Sep 27, 2016, 12:30:05 PM9/27/16
to Ansible Project
Hi, 
   May I ask for execute java program with ansible?
   I execute a java program (spring boot project, a jar package for java web site)
  ansible ofbiz1 -m shell -a "chdir=/opt/CassEC-OrderSupports nohup java -jar  product.jar &", it echo success ,but in fact,it do nothing! the java program is not been started!
  I'm very sure that I can execute nohup java -jar  product.jar & in the machine directly, I can start the java program.

  and I try use this command , 
ansible ofbiz1 -m shell -a "chdir=/opt/CassEC-OrderSupports nohup /usr/java/jdk1.8.0_74/java -jar  product.jar &",
as I prefer the java direction, it work!
 
   Can anybody tell me why? and how can I use java -jar direct with ansible?

Dick Davies

unread,
Sep 28, 2016, 3:24:01 AM9/28/16
to ansible list
I'd avoid nohup like the plague.

Why not just write a small upstart or systemd script and run your java
app as a service: task?
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-proje...@googlegroups.com.
> To post to this group, send email to ansible...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/93a1408f-18ab-43b8-8b29-90328899dea1%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages