PM2 is a process manager for Node.js that keeps apps up and running all the time. Unfortunately, this isn’t the case after a server instance reboots. So, let me show you how to do so.
- Node.js app
- sudo privileges
Step 1. Invoke the startup script.
Step 2. Verify.
systemctl status pm2-root
Note(s): pm2-root service name comes from the
pm2 startup command output. It might not be the case for you. Example output snippet:
... Command list [ 'systemctl enable pm2-root' ]
Step 3. Save the pm2 app list.
Official PM2 startup script docs. Tried everything and nothing works? Let me know in the comment section below. On a side note, follow our official channel on Telegram.