Running cron jobs when VM is suspended


I have a node app that uses “agenda” to run CRON jobs at different times of the day.
At the moment the app doesn’t have any traffic, eventually it will have some traffic but it’s early days so…

My question is when the VM detects no activity after a while, it goes into the suspended state.

Is there a way to keep it running without interruption so that the CRON jobs get executed?
Or is there a better way to do this?

If i were to leave it running 24/7 whats the expected cost per month for example? Just an estimate is fine really.

I appreciate any tips or help I can get. Thanks in advance.

Replying to myself, would pinging the server every 5 minutes via another service work to stop the VM from being suspended?

One feature that could help is New feature: Scheduled machines

Otherwise, I’d say at least let one machine run on your app 24/7 so your cron run properly. You can use min_machines_running to 1 so no ping feature is needed: Automatically Stop and Start Machines · Fly Docs

As for the price, depends on your VM: Fly App Pricing · Fly Docs. A shared-cpu-1x with 256MB RAM for example would cost $1.94 for a full month.

1 Like

Thanks for the response. I will just keep it running then.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.