DEV Community

Cover image for Cron-job.org - Free Cron service
Pavel Kutáč
Pavel Kutáč

Posted on • Updated on

Cron-job.org - Free Cron service

Cron-job.org is the free service which allows executing any URL regularly and automatically. Every second or once in a year.

🇨🇿 V češtině si lze článek přečíst na kutac.cz


Regular and automatic executing of scripts or functions is required in almost every information system. Sending email notifications, managing expired entities or just backup databases. Those are just examples of what cron is useful for.

Some alternative to cron is available in every shared web hosting. But it is often limited to the maximum amount of cron jobs or execution interval. If you run for example Laravel Queue in cron (without daemon), which is responsible for sending emails, running cron every hour is not enough.

Creation of job

Cron-job.org can do it for free

If web hosting cannot run cron more often, the only solution is its own server or service like Cron-Job.org. Which allows creating an unlimited amount of cron jobs, and the execution can be set to every minute or just once in a year.

When creating a cron job, the developer can choose from almost all HTTP methods, name and password when HTTP Basic Auth is used, or add custom HTTP Headers.

If the service cannot reach the target URL, it can notify the owner about this issue. If there are 15 subsequent failures, the job is disabled and the owner will be notified as well. The Dashboard, which is completely redesigned since the end of August, contains some history of execution with nice charts.

Executions of cron job

Must keep in mind some limitations

There are some limitations, but just minor. In the Dashboard, the user can see only the last 25 execution details or execution details in the last 2 days. If the target script is running more than 30 seconds, it is considered failed. The same happens when the script returns more than 1024 bytes of data. In both cases, the connection is closed. The best is just to return "OK" and logs everything in the server.

If you are using PHP and there is a chance script will run more than 30 s, add this line before the expensive operation starts. When the connection is closed, the PHP script will be terminated.



// This will prevent terminating script when connection is closed
ignore_user_abort(true);


Enter fullscreen mode Exit fullscreen mode

Top comments (6)

Collapse
 
aclarembeau profile image
aclarembeau

Thanks for that good article. In fact, I made a tool very similar to that, with a few more features. It's called: cronit.app
Don't hesitate to check it out

Collapse
 
rmaniego profile image
Rydeon ✨

hey...

Error 1016
Ray ID: 77cfbf48ccd787b1 •
2022-12-21 09:56:19 UTC
Origin DNS error
What happened?
You've requested a page on a website (api.cronit.app) that is on the Cloudflare network. Cloudflare is currently unable to resolve your requested domain (api.cronit.app).

Collapse
 
yellow1912 profile image
yellow1912

That is nice. How do you plan to sustain this service? When I see a nice service I want to use then I want to pay to keep it alive.

Collapse
 
arxeiss profile image
Pavel Kutáč

I'm not the author of the service. I'm just using it, like it and I thought I could write a post about it to spread it more. Feel free to ask the author for adding the Donate button!

Collapse
 
deep1358 profile image
deep1358 • Edited

I wanna send email periodically, and I have written the endpoint for the same.
So now only work I have to do is to provide that endpoint link, am I correct?

Collapse
 
arxeiss profile image
Pavel Kutáč

Yes, you create an account in Cron-job.org and insert that endpoint there. That's it