On an Amazon S3 Linux instance, I have two scripts called start_my_app
and stop_my_app
which start and stop forever (which in turn runs my
Edit the rc.local file using nano
or gedit
editor and add your scripts in it. File path could be /etc/rc.local
or /etc/rc.d/rc.local
.
sudo nano /etc/rc.local
This is the edit:
#!/bin/sh
/path-to-your-script/your-scipt-name.sh
once done press ctrl+o
to update, pressEnter
then ctrl+x
.
Make the file executable.
sudo chmod 755 /etc/rc.local
Then initiate the rc-local service to run script during boot.
sudo systemctl start rc-local