12 September 2026 · One command a day
How do I restart one app with PM2 after a deploy?
The pm2 restart appname command stops one Node app managed by PM2 and starts it again with the code that is on disk now. You reach for it after a deploy, when you have pulled new code or changed a config file and the running process is still using the old version. It only touches the app you name, so every other app on the server keeps running.
The command
pm2 restart appname
pm2 is the process manager. restart tells it to kill the process and launch it again with the settings it was first started with. appname is the name PM2 knows the app by. You can find it in the name column of pm2 list, and you can use the numeric id from that list instead of the name. No sudo is needed, as long as you run it as the same user that started the app.
What you will see
user@host:~$ pm2 restart appname
[PM2] Applying action restartProcessId on app [appname](ids: [ 2 ])
[PM2] [appname](2) ✓
┌────┬──────────┬──────┬─────────┬──────┬────────┬──────┬─────────┐
│ id │ name │ mode │ pid │ ↺ │ status │ cpu │ mem │
├────┼──────────┼──────┼─────────┼──────┼────────┼──────┼─────────┤
│ 2 │ appname │ fork │ 41872 │ 6 │ online │ 0% │ 52.1mb │
└────┴──────────┴──────┴─────────┴──────┴────────┴──────┴─────────┘
The two lines starting with [PM2] confirm which process was targeted and that the action went through. The table is the same one pm2 list prints, with some columns cut here to fit. Check three things. The status should be online. The pid should be a new number, which proves a fresh process started. The ↺ column is the restart count, and it should have gone up by one. If the status says errored, or the restart count keeps climbing on its own, the new code is crashing on start. Read the last 100 lines of the app's logs to find out why.
When to use it
- You have run git pull and npm install on the server and the app needs to load the new code.
- You have edited a .env file or a config file that the app only reads at start-up.
- One app has started leaking memory or hanging and you want a clean process without touching anything else on the box.
Watch out for
A restart reuses the environment the process was first launched with. Variables set in an ecosystem file, or exported in your shell, are not re-read by a plain restart, so the app carries on with the old values. If you have changed one, run pm2 restart ecosystem.config.js --only appname --update-env from the folder that holds the file. A .env file loaded by the app itself is different, because the app reads it fresh each time it starts.
Questions people ask
What is the difference between pm2 restart and pm2 reload?
Restart kills the process and starts a new one, so there is a short gap when requests fail. Reload only works in cluster mode, where it replaces workers one at a time so the app stays up throughout.
Do I need to run pm2 save after a restart?
No. A restart does not change the list of apps, so the saved list PM2 uses to bring apps back after a reboot is still correct. You only need pm2 save after adding, deleting or renaming an app.
Restarting a single process while every other site on the same machine keeps serving is only possible on a server you control. You can get the same VPS with 20% off at https://asksteves.co.uk/vps. Affiliate link.
Everything on this blog runs on one Hostinger KVM 8. This link takes 20% off the same box.
Affiliate link.