Mohamed Mehanny
Mohamed Mehanny

Reputation: 307

cron job to run url cpanel

i need to create cron job to run URL from Cpanel every minute
when i open the link from browser it's auto generate backup for database

i choose the common setting ( once per minute ) * * * * *
and this is the command i use but no one worked

GET http://example.com/backup > /dev/null
wget http://example.com/backup
curl -s http://example.com/backup > /dev/null
wget -q -O /dev/null "http://example.com/backup" > /dev/null 2>&1

this is my references
https://forums.cpanel.net/threads/cron-job-to-call-a-web-page.60253/
Using CRON jobs to visit url?
CRON command to run URL address every 5 minutes

Upvotes: 10

Views: 34064

Answers (5)

BogdanPopa
BogdanPopa

Reputation: 475

For Cron job to work you just need to hit the url, without any output and without downloading anything.

I am using only the wget with this two parameters:

wget -q --spider https://example.com/ 
  • ‘-q’ :Turn off Wget’s output.
  • --spider : When invoked with this option, Wget will behave as a Web spider, which means that it will not download the pages, just check that they are there. For example, you can use Wget to check your bookmarks: wget --spider --force-html -i bookmarks.html This feature needs much more work for Wget to get close to the functionality of real web spiders.

Documentation: https://www.gnu.org/software/wget/manual/wget.pdf

Upvotes: 1

Don Ejeh
Don Ejeh

Reputation: 551

Alternative try this

curl -s https://example.com/cron

don't forget to add the HTTP or HTTPS protocolenter image description here

Upvotes: 5

saeid sayadi
saeid sayadi

Reputation: 61

wget -q -O /dev/null "http://example.com/backup" > /dev/null 2>&1

Upvotes: 2

Abdul Alim
Abdul Alim

Reputation: 110

You can use "links" command like:

links https://www.honeymovies.com

Upvotes: 1

Saeed Awan
Saeed Awan

Reputation: 456

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

Upvotes: 19

Related Questions