Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How can we start a Java made application as a background process in Linux (Ubuntu). In Windows using a .Net based application we could install it as a service.

So what is the professional and secure way ?

Initially my stupidity lead me to use Tomcat server :p

Edit: a little research suggest to use the command 'daemon' when starting a process in Ubuntu from the terminal

share|improve this question
add comment

1 Answer

up vote 5 down vote accepted

The correct way to do this is to add init scripts

put a start and stop script into /etc/init.d/ and then create symbolic links to these from /etc/rc[runlevel].d/ to start and stop your service

For apache2, there is this script /etc/init.d/apache2

Start script: in /etc/rc5.d:

S91apache2 -> ../init.d/apache2  

Kill script: in /etc/rc6.d and /etc/rc1.d

K09apache2 -> ../init.d/apache2

Sounds like you want rc5.d

for more detailed information read

/etc/init.d/README

For runlevels refer

More resources:

share|improve this answer
2  
Many distributions (e.g. all Debian derivatives with update-rc.d) have tools to create the correct links in the rc directories. This also keeps track of start dependencies and other nice things, so make sure to see how it is supposed to be done in the distribution. –  Daniel Andersson May 20 '12 at 13:07
    
awesome, let me read the articles :) –  Basit Anwer May 20 '12 at 15:19
    
Sathya: thanks for the markup! –  madmaze May 22 '12 at 17:07
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.