Solved

LINUX - run java -jar apex.war as service

Posted on 2013-05-30
6
691 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
Comment Utility
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
Comment Utility
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 27

Accepted Solution

by:
serialband earned 500 total points
Comment Utility
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
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 34

Expert Comment

by:johnsone
Comment Utility
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
Comment Utility
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
Comment Utility
Correct.  If you use nohup and drop it in the background it will not restart with a system restart.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
The purpose of this article is to demonstrate how we can use conditional statements using Python.
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
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.

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now