I want to run some Java programs in the background when the system boots in Ubuntu. I have tried to add a script in /etc/init.d directory but failed to start a program. i.e programs are not started. What should I do for that?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
First of all, the easiest way to run things at startup is to add them to the file
/etc/rc.local.Another simple way is to use
@rebootin your crontab. Read the cron manpage for details.However, if you want to do things properly, in addition to adding a script to
/etc/init.dyou need to tell ubuntu when the script should be run and with what parameters. This is done with the commandupdate-rc.dwhich creates a symlink from some of the/etc/rc*directories to your script. So, you’d need to do something like:However, real init scripts should be able to handle a variety of command line options and otherwise integrate to the startup process. The file
/etc/init.d/READMEhas some details and further pointers.