Upboard
First we need to download:
$ sudo npm install -g pm2
* The -g option tells npm to install the module globally, so that it's available system-wide.
PM2 is simple and easy to use.
Start Application
The first thing you will want to do is use thepm2 start
command to run your application, amikoo.upboard, in the background:
This also adds your application to PM2's process list, which is outputted every time you start an application:
As you can see, PM2 automatically assigns an App name (based on the filename, without the .js extension) and a PM2 id. PM2 also maintains other information, such as the PID of the process, its current status, and memory usage.
Thestartup
subcommand generates and configures a startup script to launch PM2 and its managed processes on server boots:
The last line of the resulting output will include a command that you must run with superuser privileges:
Run the command that was generated (similar to the highlighted output above, but with your username instead ofsammy
) to set PM2 up to start on boot (use the command from your own output):
This will create a systemdunitwhich runspm2
for your user on boot. Thispm2
instance, in turn, runshello.js
. You can check the status of the systemd unit withsystemctl
:
Last updated
Was this helpful?