my server program needs to be launched on the startup of an EC2 instance. At the minute im just launching it from my SSH with the following commands:
java -jar ~/DocumentManager/DocumentServer-0.2.jar
I tried adding this to the .bashrc and /etc/rc.local files but they only seem to work when i ssh in.
Anyone know how to make it so an instance of my application is launched when the computer boots?
Thanks,
Ben
Add ampersand(symbol '&') at the end of the command. For example, in your case,
java -jar ~/DocumentManager/DocumentServer-0.2.jar &
Old question, but my answer might be helpful for people who look in future.
It's possible you can create a script
java_server_launch.sh
like this:Put your script under /etc/init.d directory, and then use the command:
more on update-rc.d command by using
man update-rc.d
.Hope this help.
Regards.