-
Is there a way to start / stop a cron from which the micro eg endpoint receives a trigger? The cron is part of the same micro. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
deta supports setting and "unsetting" a cron from the cli: https://docs.deta.sh/docs/micros/cron#set-cron this works because cron works with other frameworks: https://docs.deta.sh/docs/micros/cron#cron-and-http |
Beta Was this translation helpful? Give feedback.
-
Step 1: Store some flags inside base. You can develop some endpoints to update those flags inside the base. Let's say you have some key @app.lib.cron()
def cron_job(event):
start = base.get('start')
if start:
# do stuff here.....
return "Hello Deta, I am a cron job" Now you can make some endpoint to interact with the base and change the value of key Note: If I were to say to do something like you said I wouldn't have even used corn! |
Beta Was this translation helpful? Give feedback.
deta supports setting and "unsetting" a cron from the cli: https://docs.deta.sh/docs/micros/cron#set-cron
you can however write your own logic which could depend on some data/flag stored in base which you could update via the micro endpoint.
this works because cron works with other frameworks: https://docs.deta.sh/docs/micros/cron#cron-and-http