Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Linux by (9.5k points)

I’m running two scripts called start_my_app and stop_my_app on my Amazon S3 Linux instance. These scripts manually start and stop my Node.js application. But I want my start_my_app to run when the system boots up. Can anyone tell me how to do it?

1 Answer

0 votes
by (19.7k points)

Create  a init.d file and add  /etc/init.d/ and set it to executable like below: 

chmod +x /etc/init.d/start_my_app

You can create a symlink to  /etc/init.d/ if the above doesn’t run: 

ln -s /etc/init.d/start_my_app /etc/rc.d/

To avoid any unexpected errors, put the absolute path of your script like below and add #!/bin/sh on top of the file:

/var/myscripts/start_my_app

Interested in Linux? Check out this Linux Certification by Intellipaat.  

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Browse Categories

...