Solved

LINUX - run java -jar apex.war as service

Posted on 2013-05-30
6
699 Views
Last Modified: 2013-06-21
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
Comment
Question by:bcarlis
  • 3
  • 2
6 Comments
 
LVL 34

Expert Comment

by:johnsone
ID: 39209148
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
 
LVL 2

Author Comment

by:bcarlis
ID: 39209309
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
 
LVL 28

Accepted Solution

by:
serialband earned 500 total points
ID: 39209403
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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
LVL 34

Expert Comment

by:johnsone
ID: 39209644
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
 
LVL 2

Author Comment

by:bcarlis
ID: 39212267
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
 
LVL 34

Expert Comment

by:johnsone
ID: 39212682
Correct.  If you use nohup and drop it in the background it will not restart with a system restart.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Fine Tune your automatic Updates for Ubuntu / Debian
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question