Ubuntu run script on start up

In order to run custom script on start up on Linux / Ubuntu system, you can follow these steps:

Create custom file e.g. startup_script in your home folder

vim startup_script

Then edit script and enter following

bundle exec rails s

Now make that script executable

chmod +x startup_script

Now open cron tab

crontab -e

And add line at the end of that file that calls your custom created script that should run on startup.

@restart /home/startup_script

Now each time your server is restarted it will start your applications immediately.