-1

I am using MVC framework. Now I want to set up cron such that the URL "http://www.xyz.com/controllera/functiona" should be executed. what should i write in the path section for it.

I got something about "GET" command but it wasnt clear.

Can someone please help me out with it?

Abhishek Sanghvi
  • 4,582
  • 6
  • 28
  • 36

2 Answers2

2

As you didn't specify any framework the only way to run this cron is this command

  wget --spider 'http://www.xyz.com/controllera/functiona'

I assume you are using an MVC framework as controllera is in the url. If it was Kohana (2.3) framework I would have run it by

  /usr/bin/php /path/to/index.php controller/method

Most framework has cli interface to run a controller method. Search for your framework.

See these links for different frameworks.

  1. Zend Framework
  2. Kohana 2 & 3
  3. Codeignier
  4. Yii
Community
  • 1
  • 1
Shiplu Mokaddim
  • 56,364
  • 17
  • 141
  • 187
0

I don't understand the "module called cron" part of your question. I believe you are confused, cron is a service on Linux and other Unix systems configured thru crontab.

A crontab(5) entry is defined by a time and date and a command to run.

On Linux and Posix systems, you cannot execute or run an URL. Running something involves the execve(2) system call, which requires an executable file path (and arguments).

Perhaps you want to retrieve some URL using the HTTP protocol. You might use a command-line HTTP client, like wget or curl.

So perhaps the command you want to run in your crontab might be

 wget http://www.xyz.com/controllera/functiona

but you could use curl

My guess is that you are confused, and don't understand well enough your question. Consider reading some material.

For example, to retrieve that URL once a day at 3 pm, you would have the following crontab entry:

   # run everyday at 3 pm a GET HTTP request
   0 15 * * *  /usr/bin/wget http://www.xyz.com/controllera/functiona

Use the crontab(1) command to configure your crontab (which may contain several entries, and several variable definitions, so you may have to edit it).

Basile Starynkevitch
  • 223,805
  • 18
  • 296
  • 547
  • i am aware that cron is a service of linux and the statement "Module called cron" means that i have a module in mvc framework whose name is cron (it can be changed to anything for eg. aaa, bbb etc.) My question can be considered as simple as "Setting up cron for absolute URL" – Abhishek Sanghvi Jan 17 '12 at 09:03
  • Then you should refer to your MVC framework documentation (which you did not name, I have no idea what *MVC framework* you are talking about). Perhaps your framework uses the *cron* word for som other purpose. – Basile Starynkevitch Jan 17 '12 at 09:05
  • Cron in IT terms have only one defination. As i told you that Module name cron can be replaced with any other word.. – Abhishek Sanghvi Jan 17 '12 at 09:06
  • Then my answer is appropriate. – Basile Starynkevitch Jan 17 '12 at 09:10