Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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


For runlevels refer

More resources:

share|improve this answer
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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .