Sometimes we found ourselves starting manually a set of apps or webservices everytime we reboot our Ubuntu instance. We can easily automate this process.
1) Open the configuration file with sudo vi /etc/rc.local
2) Add all the commands that you want to run. For example:
cd /home/myuser
rm *.tmp
nohup java -jar /var/www/myapp/app.jar &
With nohup and the final & we force the jar file to run on background, creating the nohup.out log file.
3) Always end with exit 0
4) Save changes with :x and reboot the system. The commands that you have added should be run at start up.