Ubuntu Run Script on Start up

In order to run a custom script on startup 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:

cd /home/SOME_USER/projects/YOUR_AWESOME_FOLDER/;
bundle exec rails s

Now, make that script executable:

chmod +x startup_script

Now, open cron tab:

crontab -e

And add a 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.