pm2
pm2 copied to clipboard
cron_restart is not working after a server reboot
Hi there,
Thanks for your work on pm2 !
It is kind of annoying that processes with a cron_restart are not launching on specified date after a server reboot. Is there a way to setup the startup script to fix that behavior ? It is also the case with pm2 resurrect. So it's quite easy to test :
- pm2 restart MY_PROC --cron-restart="*/2 * * * *"
- pm2 stop MY_PROC
- pm2 save
- pm2 kill
- pm2 resurrect
MY_PROC won't restart on the next even minute.
OS Version : Ubuntu 18.04 PM2 Version : 5.2.0
--- PM2 report ---------------------------------------------------------------- Date : Mon Sep 12 2022 11:02:50 GMT+0200 (Central European Summer Time)
--- Daemon ------------------------------------------------- pm2d version : 5.2.0 node version : 16.15.1 node path : not found argv : /usr/bin/node,/usr/lib/node_modules/pm2/lib/Daemon.js argv0 : node user : nodejs uid : 1001 gid : 33 uptime : 15083min
--- CLI ---------------------------------------------------- local pm2 : 5.2.0 node version : 16.15.1 node path : /usr/bin/pm2 argv : /usr/bin/node,/usr/bin/pm2,report argv0 : node user : nodejs uid : 1001 gid : 33
--- System info -------------------------------------------- arch : x64 platform : linux type : Linux cpus : Intel(R) Xeon(R) CPU E5-2650 v4 @ 2.20GHz cpus nb : 14 freemem : 12365615104 totalmem : 16815984640 home : /home/nodejs
Someone seams to have the same problem there : https://stackoverflow.com/questions/72861927/activating-cron-restarts-on-pm2-after-reboot
Cheers,
I'm running into this this issue too. I'm on Ubuntu 22.04, PM2 v5.2.0
Same issue (Ubuntu 22.04 LTS, PM2 5.3.0)
Manually patched from arronzhang's commit (one-liner!) and rebooted, it seems to have worked! ✅
Can't wait to see this make it into release, so this doesn't catch others who might not even realize cron restart policies aren't applying on reboot.