PM2SD is a process manager for Node.js applications (or other scripts) built over system services. It is inspired by PM2, but not that complex and uses far less memory (i.e. zero memory as it is wrapper for systemd service at Linux, for instance). I love PM2, but cannot use it on small VPS for pet projects, so meet the PM2SD!
You can start process as simple as
$ pm2sd start index.js
Process will be started as system service (i.e. added to /etc/systemd/system at Linux), enabled for restart after reboot, will restart in 30 seconds if it crashes, output and error logs goes to /var/log/pm2sd-<name>
(if you want configure and start service under non-privileged user, you need to do some magic).
No clusters, no load balancers, no watching, just one living process.
It works on Linux, and Windows is in the plans 🚧 🔨.
Implemented commands: ls, start, stop, restart, delete, log.
Lists all pm2sd services. Also, you can get list of all system services with option --all
:
$ pm2sd ls --all
You can filter list of all services by part of its name with pm2sd ls <name>
.
Also you can use --json
option to get json instead of colored text output.
Starts new process. Avaliable options: name, description, time, user (i.e. service can be started from any user).
--time
adds timestamp to logs.
$ pm2sd start index.js --name=test --user=node --time
Stops process (by its name).
Restarts process (by its name).
Delete all traces of process (include logs).
Tails log of selected process (pm2sd log <name>
) or logs for all processes if nothing specified (pm2sd log
).