Giter Site home page Giter Site logo

phalcon-cron's Introduction

Sid\Phalcon\Cron

Cron component for Phalcon. Powered by sidroberts/cron.

GitHub Workflow Status GitHub release

GitHub issues GitHub pull requests

Version Requirements

Documentation

See the Wiki.

License

Licensed under the MIT License. © Sid Roberts

phalcon-cron's People

Contributors

hgati avatar sidroberts avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

phalcon-cron's Issues

Weird issue with Libmemcached Metadata and background mode

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.

SidRoberts/phalcon-cron need help on running cron job

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)

Right implementation?

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

Service 'console' wasn't found in the dependency injection container

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?

PhalconPHP v4

Phalcon v4 released as stable.
Will you support the new version?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.