cronjob in cakephp 1.3

2013-06-21 Thread Chris
Hi guys,... can anyone help please 
I'm trying to run cronjob and execute function update() in 
guests_controller.php to remove outdated raws from guests table with field 
ending. 
I run it in ssh to test on server e.g. /usr/bin/php -f 
/home/path_to/my_domain.com/html/app/controllers/guests_controller/update 
so is the /usr/bin/php -f 
/home/path_to/my_domain.com/html/app/controllers/guests_controller.php/update 

but it gives me an error .../html/app/controllers/guests_controller/update 
 AND/OR .../html/app/controllers/guests_controller.php/update Could not be 
found

and here is my function in guests_controller.php: 

   function update()
{
$this-layout = null;
Configure::write('debug', 0);

  $today_date = date('Y-m-d H:i:s');
$guests = $this-Guest-find('all');

foreach ($guests as $guest)
{
if($guest['Guest']['ending'] = $today_date)
{
$this-Guest-delete($guest['Guest']['id']);
}
}
}

thanks in advance 
chris 

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.




Re: cronjob in cakephp 1.3

2013-06-21 Thread Marcus James
Hi Chris,

Add this file cron_dispatcher.php under /app/webroot/.

Then to call the function from ssh you need to write it like this:-

/usr/bin/php  path_to_your_project_webroot/cron_dispatcher.php
/guests/update

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


attachment: cron_dispatcher.php


Re: cronjob in cakephp 1.3

2013-06-21 Thread Chris
thanks marco,... it works !!! 

also,... 
we need to include this code into a function in a controller: 


   function update()
{

if (!defined('CRON_DISPATCHER')) 
{ 
$this-redirect('/'); exit(); 
}
   and the rest of a coding, 




On Friday, June 21, 2013 12:08:10 AM UTC-7, marco metal wrote:

 Hi Chris,

 Add this file cron_dispatcher.php under /app/webroot/.

 Then to call the function from ssh you need to write it like this:-

 /usr/bin/php  path_to_your_project_webroot/cron_dispatcher.php  
 /guests/update


-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.