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
LVL 2
BILL CarlisleAPEX DeveloperAsked:
Who is Participating?
 
serialbandConnect With a Mentor Commented:
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
 
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
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
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
All Courses

From novice to tech pro — start learning today.