• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 794
  • Last Modified:

LINUX - run java -jar apex.war as service

Hi,

What's the command to run a commandline app as a service?

run this from commandline
java -jar apex.war standalone --port 7778 --apex-images /home/mont/apex/images

it starts listening to port 7778

so I want to it to run as a service on the server..

thanks, Bill
0
BILL Carlisle
Asked:
BILL Carlisle
  • 3
  • 2
1 Solution
 
johnsoneSenior Oracle DBACommented:
Did you try searching for an answer?  This link seems to have the necessary steps:

http://www.unix.com/unix-dummies-questions-answers/34641-making-script-start-service.html
0
 
BILL CarlisleAPEX DeveloperAuthor Commented:
Yes,

But I wouldn't have seen that one as an answer because it has no solution that worked and I would need an example for the shell script calling the java command.
0
 
serialbandCommented:
Here's a Debian example with a sample line of java script that you could use.

http://www.ralfebert.de/blog/java/debian_daemon/


If you're unsure of how to create a standard init script, maybe you should try the java service wrapper.

http://wrapper.tanukisoftware.com/doc/english/download.jsp
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
johnsoneSenior Oracle DBACommented:
The second comment in the link that I posted has the solution.  You need to put the command you have into the start section of the script.
0
 
BILL CarlisleAPEX DeveloperAuthor Commented:
what about the
$nohup java -jar apex.war

that starts in the background but it won't restart with a restart on server right?

so first comment in the second post looks like one to try..
0
 
johnsoneSenior Oracle DBACommented:
Correct.  If you use nohup and drop it in the background it will not restart with a system restart.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now