My cronjobs command does not work?

ArfanHaider

Member
Jan 12, 2013
13
0
1
cPanel Access Level
Website Owner
I can set my cornjob command but it does not work

wget -O /dev/null http://mydomainname.com/cornjod.php?anydata="something"
can it is villade
I want to run file through url using cornjobs how can I do that please guide me?
 
Last edited:

ArfanHaider

Member
Jan 12, 2013
13
0
1
cPanel Access Level
Website Owner
Cron-Jobs does not work if I run php file via URL?

I can set a cron-job which run php file via url but it does not work.
but path file are work well.like
/home/path/to/file.php
but Here is a file which I want to run via url.
Please tell me why cron job are not work if i run file via url???????
 

JaredR.

Well-Known Member
Feb 25, 2010
1,834
23
143
Houston, TX
cPanel Access Level
Root Administrator
Re: Cron-Jobs does not work if I run php file via URL?

You cannot enter only a URL as a cron job command. It just will not work. A cron job needs to be a command that would be valid if you run it from the shell. As you have seen, calling a script by a path is valid in the shell; calling it via a URL is not valid in the shell.

If you need to run a cron job by accessing it by URL, use curl to call the URL. If the objective is to call /http://mysite.com/cron.php, then make this your cron command:

Code:
curl http://mysite.com/cron.php
That way, you are telling curl to get the URL for you. cron cannot do anything with a URL directly because cron is not a Web browser.
 

ArfanHaider

Member
Jan 12, 2013
13
0
1
cPanel Access Level
Website Owner
Re: Cron-Jobs does not work if I run php file via URL?

I wan to run my locally file via URL due to some reason. I use curl but does not work.