Is it possible to suspend services based on time? (and best practices)

We have a need to suspend / resume a couple of services based on time. So for example maybe we want them off over the weekend (the specifics don’t matter so much).

Render API

I know there is an API endpoint which can do this, so I could certainly write a short script to suspend at a certain time and resume at a certain time, but I’m trying to work out the best way to approach this?

Cron within Render? Or outside?

A cron hanging off one of the services that will never get suspended might be the best? Or perhaps I should use something completely outside of Render to keep things super separated?

I don’t see a way to do this from within Render itself (I think it is too niche a requirement).

Hey there.

So leveraging the API seems a reasonable approach - you could use a cron to perform that to call the API itself - our cron service types could do this, one run to unsuspend services and another to resuspend them.

Alternatively, using a background worker to schedule them accordingly but you’d need to be using a paid instance to perform that so that may work out more than for running the suspend/unsuspend operation each day.

1 Like

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