LINUX - run java -jar apex.war as service


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
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.

If you're unsure of how to create a standard init script, maybe you should try the java service wrapper.
johnsoneSenior Oracle DBACommented:
Did you try searching for an answer?  This link seems to have the necessary steps:
BILL CarlisleAPEX DeveloperAuthor Commented:

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.
The new generation of project management tools

With’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.
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..
johnsoneSenior Oracle DBACommented:
Correct.  If you use nohup and drop it in the background it will not restart with a system restart.
All Courses

From novice to tech pro — start learning today.