I use to run an application in CentOS with the command

 nohup java -jar AnalyticsBackend.jar &

Now I want to run this application as daemon i.e. on reboot, this application shoud start running automatically. How can I do this ? Please help me.


Daemonizing an application is not identical to starting it at boot. If all you want is to have it start automatically at boot, read on; otherwise, somewhat more complex instructions will have to be provided, or, better still, you should look up how to configure your own service.

To start a program automatically at boot, issue the command

  EDITOR=vi crontab -e 

(if you don't like vi as an editor put whatever you like in its stead) then add the following line:

  @reboot /home/myname/bin/myscript

Save, edit the file /home/myname/bin/myscript and put into it the following lines:


 nohup java -jar Analyticsbackend.jar 

Save, make the file executable,

 chmod 755 /home/mynmae/bin/myscript, reboot, you are done. 

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.