pm2 icon indicating copy to clipboard operation
pm2 copied to clipboard

PM2 saves stopped status when system reboots

Open criyle opened this issue 3 months ago • 0 comments

I am running a program that will create a transient systemd scope on its own, and I reboot the system using systemctl reboot.

During the reboot process, systemd sends the SIGTERM to all processes. There is one situation where

  1. The program was killed by systemd, so PM2 marked it as STOPPED
  2. The PM2 then receives the SIGTERM and it dump the process list with status STOPPED

In this case, the program will not restart the program after reboot and ignore previous pm2 save with running program.

The ~/pm2/pm2.log looks like this

2025-09-18T11:04:12: PM2 log: App [hydro-sandbox:0] exited with code [0] via signal [SIGTERM]
2025-09-18T11:04:12: PM2 log: pm2 has been killed by signal, dumping process list before exit...
2025-09-18T11:04:12: PM2 log: Deleting process 0

The expected behavior is the PM2 should restart the App correctly after reboot.

criyle avatar Sep 18 '25 15:09 criyle