opkbuilder.blogg.se

Raspberry pi how to make a program run at startup
Raspberry pi how to make a program run at startup




  • To start a script defined in the package.json file for your application, you can use this command, pm2 start npm - run.
  • To start a file, you can use this command, pm2 start index.js, where index.js is the path to the file that you want to run.
  • Then, choose the appropriate command from the two options below:

    raspberry pi how to make a program run at startup

    To do this, navigate to the application folder in the terminal. Running the Application with PM2 The first step is to start the application using PM2. Using PM2 to Start a Node.js Application on Boot

    raspberry pi how to make a program run at startup

    The -g means that the package will be installed globally on the Pi. The PM2 CLI can be installed using npm by running the following in your terminal: npm install pm2 -g It has great documentation and is quick to get started with, which is why I’ve chosen to use it for a number of my applications. PM2 is a popular process manager that offers all of the features above and then some. This includes things like startup scripts, deployment management, logging, monitoring, hot reloading, and more.

    raspberry pi how to make a program run at startup

    Process managers let you control the lifecycle of your application by providing a means to manage common tasks needed to keep your application running. PM2, which stands for Process Manager 2, is a process manager for Node.js applications. While doable, this step can be automated by configuring the application to run when the Pi boots by using a process manager called PM2. What happens when you need to reboot the Pi or if it temporarily loses power though? You have to manually go through the steps above again to get your application running.






    Raspberry pi how to make a program run at startup