I experimenting with pm2, which is a process manager for node.js applications. I tried their pm2 startup utility which generates and installs a startup script for pm2 when the system restarts.
I tried this on my mac, and it works flawlessly. The pm2 automatically restarts and spawns up all my node scripts.
However now, I am done experimenting and how do I remove this from my startup? I wish pm2 came with a similarly simple utility to uninstall itself from startup.
I am aware that it is using launchd
on mac to restart the process. I noticed that it installed a io.keymetrics.PM2.plist
file under /Users/<username>/Library/LaunchAgents
directory.
Is it as simple as just deleting this file? or is it doing something more intrusive , and needs a more graceful uninstall?
It internally uses the following command to install the startup script
sudo env PATH=$PATH:/usr/local/bin pm2 startup darwin -u shaunak
PM2 is designed to work with the default init system on a Linux system (which it can auto-detect) to generate the startup script and configure PM2 as a service that can be restarted at system boot. The startup sub-command tells PM2 to detect available init system, generate configuration and enable the startup system.
Persistent applications: Startup Script Generator PM2 can generate startup scripts and configure them in order to keep your process list intact across expected or unexpected machine restarts. These init systems are automatically detected by PM2 with the pm2 startup command.
pm2 unstartup
works fine on Ubuntu 16.04 which internally uses the following command:
sudo env PATH=$PATH:/usr/bin /usr/lib/node_modules/pm2/bin/pm2 unstartup systemd
Same should work on Mac as well (but the internal command will look a little different).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With