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

1 Answer 1


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:

  • 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. May 20, 2012 at 13:07
  • awesome, let me read the articles :) May 20, 2012 at 15:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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