Thursday, June 20, 2013

cronjob in cakephp 1.3

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+unsubscribe@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.
 
 

No comments: