
Hi Friends, Hope you guys are doing well. It’s been a long time I haven’t share anything but today I am going to share how to use cURL in a cron job. It is useful when sometimes your server’s cron job is not acting as per your expectations or it has some restrictions.
In this condition, you can take help from another server using this command.
1 |
curl https://www.yourdomain.com/cron.php |
If you don’t want to get a notification email every time when cron job executes so you can use it.
1 |
>/dev/null 2>&1 |
So the complete command will look like it.
1 |
https://www.yourdomain.com/cronjob.php >/dev/null 2>&1 |
You can get help to set timings for execution for cron job
Here are 3 examples of cron jobs
The first cron job is executed every 5 minutes
In the 2nd example, the cron job executes every 23 hours
In the 3rd example, Cron Job executes every Saturday 05:33. A cron job week start from Monday. so Saturday will be the 6th day of the week.
I hope with the above examples you have learned of the functioning of CRON JOB using cURL. Please do like & share. It motivates us to keep working to post useful content.