Easy startup scripts with pm2
Not too long ago, I had to setup a virtual machine to be used as a simple server at work. The VMs go on and off on a schedule and I needed to figure out a way to start a strapi server automatically. pm2 made it super easy.
npm install pm2@latest -g
Create a script and upload it to you server. Then start it with pm2 with the following command:
# your script can be a javascript or shell file
pm2 start [script]
After you start your script, to make it run on startup, do:
pm2 startup
pm2 save
That's all! Check out pm2’s quick start guide and their docs for more details of course.