How to run a shell script at startup

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 Node.js application). I use these scripts to manually start and stop my Node.js application. So far so good.

My problem: I also want to set it up such that start_my_app is run whenever the system boots up. I know that I need to add a file inside init.d and I know how to symlink it to the proper directory within rc.d, but I can’t figure out what actually needs to go inside the file that I place in init.d. I’m thinking it should be just one line, like, start_my_app, but that hasn’t been working for me.

22 Answers
22

Leave a Comment