How to run scripts after boot in Linux
Often there is need to run script after a reboot of the machine. Especially in case of AWS and you want to reduce the costs of the EC2 instances, it is advisable to start instances only when needed and then shut them down when no task is running in that machine. To achieve that it is very convenient if the scripts get exceuted by default after reboot.
First you need to launch EC2 instance and set everything up including all dependencies and a script to execute them all.
and then add
@reboot /bin/bash /start_script.sh
Make sure about the executable and ownership rights of the start_script.sh file.
That's it !