Cron component for Phalcon. Powered by sidroberts/cron.
See the Wiki.
Licensed under the MIT License. © Sid Roberts
Cron component for Phalcon.
License: MIT License
Cron component for Phalcon. Powered by sidroberts/cron.
See the Wiki.
Licensed under the MIT License. © Sid Roberts
When using manager in background mode with phalcon Libmemcached metadata(no matter if persistent connection or not) with php-memcached 3.1.5 and libmemcached 1.0.18 i have really weird issue that sometimes there are errors returned like 'Column 'created' doesn't belong to any of the selected models (1),
. This happens only on libmemcached, using memcache for some reason works.
Also when using foreground mode it works fine too. It seems that pcntl_fork
is causing some problems, also it sometimes happens, sometimes not. Totally random. Sometimes there are wrong values returned for certain keys etc. Not sure what exactly it's happening and what to even investigate.
I don't know, maybe someone got this issue too and know the answer what's the problem, really struggle with this.
Hello,
I searched extensively on running cron job in Phalcon php. 1.I copied cli.php file content from Phalcon Docs. 2. Copied $di->set( "cron" code in cli.php from SidRoberts/phalcon-cron Wiki.
3. Added cli.php inside app folder. 4. Created CronTask.php with foll content:
<----start code---->
use Sid/Phalcon/Cron;
//require_once "phalcon-cron-1.0.x";
class CronTask extends \Phalcon\Cli\Task
{
public function mainAction()
{
$cron = new \Sid\Phalcon\Cron\Manager();
$cron->add(
new \Sid\Phalcon\Cron\Job\System(
"37 16 * * *",
"/usr/local/bin/php /home/username/public_html/app/cli.php main mailcron"
)
);
$cron->runInBackground();
}
}
<----end code----->
5. Created MainTask.php with foll function:
<-------start code---------------->
public function mailcronAction()
{
$mail = new SendMailSms();
$mail->sendMail("[email protected]","Hi","Hello");
mail("[email protected]","Hi","Hello");
}
<-------end code----------------->
Mail is not sent. I've tried calling both php mail function and PHPMailer function.
6. In crontab i've given foll command:
10 20 * * * /usr/local/bin/php /home/username/public_html/app/cli.php cron
Added task.php files inside app/tasks folder.
Kindly help me by correcting where ever there's mistake and guide me on how to run cron job in phalcon php(7.2)
I've been reading the docs but I can't figure out how to get the library running.
I got a phalcon clit task running Ok, the idea is create a cron job to execute that task.
This is my code
$this->app->di->set(
"cron_data_fetch",
function () {
$cron = new \Sid\Phalcon\Cron\Manager();
$cron->add(
new \Sid\Phalcon\Cron\Job\System(
"* 8 * * *",
"php console.php mytask action"
)
);
});
What else I need to do? I also attatch the console to the DI with
$console = new \Phalcon\Cli\Console();
$di->setShared("console", $console);
And I tried adding the cron this way
$cron->add(
new \Sid\Phalcon\Cron\Job\Phalcon(
"* 8 * * *",
[
"task" => "task",
"action" => "action",
"params" => "params"
]
)
);
But it's not working
Thanks
Is it works with phalcon version 2.0.1 ?
I get such error:
Service 'console' wasn't found in the dependency injection container
when I call:
/usr/bin/php /vagrant/www/cli.php cron
I think it is caused by:
public function runInForeground()
{
ob_start();
$this->getDI()->get("console")->handle(
$this->getBody()
);
$contents = ob_get_contents();
ob_end_clean();
return $contents;
}
in vendor/sidroberts/phalcon-cron/src/Job/Phalcon.php
What should be instanced as 'console' in DI?
Phalcon v4 released as stable.
Will you support the new version?
See sidroberts/cron.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.