I need a cron job in one of my older web site (CakePHP 1.3). I made the following steps:
created shell in
/somepath/public_html/app/vendors/shells/valute.php
class ValuteShell extends Shell { var $uses = array('Valute'); function main() { $this->Valute->cacheGetKonverterData(); } }
created BASH script and save this to my vendors folder as
cakeshell
(/somepath/public_html/app/vendors/cakeshell)
#!/bin/bash TERM=dumb export TERM cmd="cake" while [ $# -ne 0 ]; do if [ "$1" = "-cli" ] || [ "$1" = "-console" ]; then PATH=$PATH:$2 shift else cmd="${cmd} $1" fi shift done $cmd
changed the permissions on the this file to 777.
called cronjob like this:
0 0 * * * /somepath/public_html/app/vendors/cakeshell valute -cli /usr/bin -console /somepath/public_html/cake/console -app /somepath/public_html/app
Unfortunately cronjob does not work. Why? When I call: http://www.somedomain.net/valutes/save_valute everything works fine.
<?php
class ValutesController extends AppController {
var $name = 'Valutes';
var $uses = array('Valute');
function save_valutes()
{
$this->layout = null; // turn off the layout
$this->Valute->cacheGetKonverterData();
}
}
?>