Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cron_restart is not working after a server reboot #5443

Closed
creativityjuice opened this issue Sep 12, 2022 · 3 comments
Closed

cron_restart is not working after a server reboot #5443

creativityjuice opened this issue Sep 12, 2022 · 3 comments

Comments

@creativityjuice
Copy link

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 :

  1. pm2 restart MY_PROC --cron-restart="*/2 * * * *"
  2. pm2 stop MY_PROC
  3. pm2 save
  4. pm2 kill
  5. 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

@creativityjuice
Copy link
Author

Someone seams to have the same problem there : https://stackoverflow.com/questions/72861927/activating-cron-restarts-on-pm2-after-reboot

Cheers,

@followfung
Copy link

I'm running into this this issue too.
I'm on Ubuntu 22.04, PM2 v5.2.0

Unitech added a commit that referenced this issue Mar 15, 2023
Fix: #5443 - resume cron rule when resurrect
@christopherseaman
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants