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.
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
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:
Save, edit the file /home/myname/bin/myscript and put into it the following lines:
#!/bin/sh nohup java -jar Analyticsbackend.jar
Save, make the file executable,
chmod 755 /home/mynmae/bin/myscript, reboot, you are done.