CRON command to run URL address every 5 minutes
Based on the comments try
*/5 * * * * wget http://example.com/check
[Edit: 10 Apr 2017]
This answer still seems to be getting a few hits so I thought I'd add a link to a new page I stumbled across which may help create cron commands: https://crontab.guru
Using CRON jobs to visit url?
* * * * * wget -O - http://yoursite.com/tasks.php >/dev/null 2>&1
That should work for you. Just have a wget
script that loads the page.
Using -O -
means that the output of the web request will be sent to STDOUT (standard output)
by adding >/dev/null
we instruct standard output to be redirect to a black hole.
by adding 2>&1
we instruct STDERR (errors) to also be sent to STDOUT, and thus all output will be sent to a blackhole. (so it will load the website, but never write a file anywhere)
cron job to run url cpanel
use this
wget -q -O - http://example.com/backup >/dev/null 2>&1
instead of
wget -q -O /dev/null "http://example.com/backup" > /dev/null 2>&1
Creating a Cron job for URL
Please use lynx text browser (if your server does not have lynx, install it).
then use
*/5 * * * * /usr/bin/lynx https://example.com/?pull-feeds=7b2e9c8d534d6c38ca98c726899b6153 -dump
How to run a cron jobs in every minute for a specific hour on server
To include multiple specific values in a cron job you separate them with commas.
For 16-17 you want 16,17
so you get:
# m | h | d | m | Day of week
* 16,17 * * *
# All the below can include multiple values using commas
# m = minute (minute from 0 to 59)
# h = hour (hour of the day, from 0 to 23)
# d = day (day of month, from 1 to 31)
# m = month (month of the year, where 1 is January)
# dow = day of the week (0-7 where 0 and 7 are Sunday)
Run Cron job every N minutes plus offset
To run a task every 20 minutes starting at 5 past the hour, try this:
5-59/20 * * * *
Explanation
An *
in the minute field is the same as 0-59/1
where 0-59
is the range and 1
is the step. The command will run at the first minute in the range (0), then at all successive minutes that are distant from the first by step (1), until the last (59).
Which is why */20 * * * *
will run at 0 minutes, 20 minutes after, and 40 minutes after -- which is the same as every 20 minutes. However, */25 * * * *
will run at 0 minutes, 25 minutes after, and 50 minutes after -- which is not the same as every 25 minutes. That's why it's usually desirable to use a step value in the minute field that divides evenly into 60.
So to offset the start time, specify the range explicitly and set the first value to the amount of the offset.
Examples
5-59/20 * * * *
will run at 5 minutes after, 25 minutes after, and 45 minutes after.
10-59/25 * * * *
will run at 10 minutes after and 35 minutes after.
1-59/2 * * * *
will run every odd minute.
I need to run cronjob every 5 minutes plus offset time
Following the KISS principle you could just list the minutes
2,7,12,17,22,27,32,37,42,47,52,57
Example:
2,7,12,17,22,27,32,37,42,47,52,57 * * * * curl http://localhost/aa_portal/refresh_id.php
Related Topics
Call PHP from Virtual/Custom "Web Server"
Setting Document Root for Laravel Project on Apache Virtual Host
PHP and Microsoft Access Database - Connection and Crud
How to Use String Concatenation to Define a Class Const in PHP
Pdo Error: SQLstate[Hy000]: General Error: 2031
Overwrite Line in File with PHP
How to Set the Cookie Content with Curl
Laravel 5.5 Error Base Table or View Already Exists: 1050 Table 'Users' Already Exists
How to Correct the [Composer\Downloader\Transportexception] Error for Composer
Using Simplexml to Load Remote Url
Php: iPad Does Not Play Mp4 Videos Delivered by PHP, But If Accessed Directly It Does
Getting a PHP Pdo Connection from a MySQL_Connect()
Warning: Array_Combine(): Both Parameters Should Have an Equal Number of Elements
Fix Incorrectly Displayed Encoding on an HTML Document with PHP
How to Get User Timezone Using Jquery