R
Railway17mo ago
patod01

is this the way to work with cronjobs or am I misusing the feature?

I just saw the changelog and I'm trying out the new cronjob feature. I didn't know about cronjobs before so if I'm being dumb... I'm sorry xD. Is it ok if I want to run a cronjob like the next one or is there a better optimized way of doing it? let's say I want to log something every 5 minutes. I made this: schedule: 0/5 * * * * docker image: python:3.11-alpine start command: python -c "print('a')" I thought it could re-run the service, but it deploys a new one and removes the old one every 5 minutes, so I'm afraid of a possible impact on metrics mildpanic
Solution:
assuming you've exited with 0 (success) it would still show as active, cron is very new so I'm sure they'll update the UI to be give a better indication of the state of the cron service
Jump to solution
14 Replies
Percy
Percy17mo ago
Project ID: 6c155b28-ee18-4f98-a1a8-995bca9ebafa
patod01
patod01OP17mo ago
6c155b28-ee18-4f98-a1a8-995bca9ebafa
Brody
Brody17mo ago
the cron will re-deploy your app every 5 minutes, you are printing a single letter, so as long as you exit afterwards, the monthly costs would be pennys
patod01
patod01OP17mo ago
so, am I doing it as expected? I can't believe it would be that easy
Brody
Brody17mo ago
you aren't exiting, and I don't know why you would use a start command to print a letter, normally you'd have cron run an actual python app
patod01
patod01OP17mo ago
I see. I just didn't want to make a more elaborated program for testing purposes The print statement is to simulate an actual task. When you call python like this from docker, it executes the python TASK.py | APP.py and then the container stops running. -c STATEMENT works the same one last question
patod01
patod01OP17mo ago
when I exit, does the service still display this icon?
Solution
Brody
Brody17mo ago
assuming you've exited with 0 (success) it would still show as active, cron is very new so I'm sure they'll update the UI to be give a better indication of the state of the cron service
patod01
patod01OP17mo ago
from what i've been testing in the platform and from what you told me, I think that I've learned a lot about cronjobs and now I know how to better google it by myself from now on thanks a lot!!! (: and sorry if my english was hard to read
Brody
Brody17mo ago
no problem, your English was fine!
patod01
patod01OP17mo ago
have a nice day / night! ^^
Brody
Brody17mo ago
you as well!
luffytaro
luffytaro17mo ago
i need help fot set up my corn job.
Brody
Brody17mo ago
please open your own help thread
Want results from more Discord servers?
Add your server