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.
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.
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);