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
start_my_app
stop_my_app
Set a crontab for this
#crontab -e @reboot /home/user/test.sh
after every startup it will run the test script.