I have a zendframework project for which i need to run a script periodically to upload the content of a folder and another do download. The script itself is ready but I am struggling to figure out where or how to set up the script to run. I have tried lynx and curl so far. I first had an error about specified controller being wrong and i fixed that but now I just get a blank screen when I run the script but file(s) are not uploaded.
For a zendframework project how do I setup script to be run by cron?
EDIT:
My project structure looks like this:
mydomain.com
application
library
logs
public
index.php
scripts
cronjob.php
tests
cronjob.php is the script i need to run. The first few lines of which are:
<?php
define("_CRONJOB_",true);
require('/var/www/remotedomain.info/public/index.php');
I also modified my index.php file like below:
// Create application, bootstrap, and run
$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini'
);
$application->bootstrap();
/** Cronjobs don't need all the extra's **/
if(!defined('_CRONJOB_') || _CRONJOB_ == false)
{
$application->bootstrap()->run();
}
However now when i now try to run the script, I get the message:
Message: Invalid controller specified (scripts).
Does it mean that I need to create a controller for the purpose? But the script folder is outside the application folder. How do i fix this?
Thanks all for your answers. However the solution that worked for me came from this site Howto: Zend Framework Cron. The original link is dead, but its copy can be found on Internet Archive.
I am posting a cut of the code here. But please this is not my solution. All credits goes to the original author.
cronjob.php
index.php