Solved

LINUX - run java -jar apex.war as service

Posted on 2013-05-30
6
703 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 29

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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
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

Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
This video shows how to recover a database from a user managed backup
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.

840 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