Code Monkey home page Code Monkey logo

Comments (15)

liebig avatar liebig commented on July 16, 2024

Hi @lokielse, thank you for your message. That really sounds strange. I will check this.

from cron.

liebig avatar liebig commented on July 16, 2024

Okay I installed PHP Version 5.5.15-1~dotdeb.1 and have the following code:

Route::get('cron/test', function () {

    Cron::setDisablePreventOverlapping();
    Cron::setDatabaseLogging(true);
    Cron::setLogOnlyErrorJobsToDatabase(false);

    Cron::add('test_cron_1', '* * * * * *', function () {
    });

    Cron::add('test_cron_2', '0 0 * * *', function () {
    });

    Cron::add('test_cron_3', '0 1 * * *', function () {
    });

    Cron::add('test_cron_4', '0 2 * * *', function () {
    });

    Cron::add('test_cron_5', '0 3 * * *', function () {
    });

    Cron::add('test_cron_6', '0 4 * * *', function () {
    });

    Cron::add('test_cron_7', '0 5 * * *', function () {
    });

    Cron::add('test_cron_8', '0 6 * * *', function () {
    });

    Cron::add('test_cron_9', '0 9 * * *', function () {
    });

    Cron::add('test_cron_10', '0 12 * * *', function () {
    });

    return Cron::run();
});

Unfortunately it works for me and I don't get the Impossible CRON expression. Can you provide me your code?

from cron.

lokielse avatar lokielse commented on July 16, 2024

I use your code snippet one by one.
cron commit hash 40aeff3f52038474abee47a3716c64a803dfd683

this work

Cron::add('test_cron_1', '* * * * * *', function () {
});

this one not work

Cron::add('test_cron_2', '0 0 * * *', function () {
 });

and I truncate tables cron_job and cron_manageer.

Then after I reinstall your cron lib just now.

this one work

Cron::add('test_cron_2', '0 0 * * *', function () {
 });

but this one not work

Cron::add('test_cron_3, '0 1 * * *', function () {
 });

I guess that it related to the time.

from cron.

lokielse avatar lokielse commented on July 16, 2024

mtdowling/cron-expression#60

from cron.

liebig avatar liebig commented on July 16, 2024

That is really strange. I only get the Impossible CRON expression if the expression is only for the past. For example Cron::add('test_cron_1', '* * * * * 2014', function () {});works fine but Cron::add('test_cron_1', '* * * * * 2013', function () {}); does throw the exception. This behaviour is correct because using an expression which will never be true is an error. Please try to use Cron::add('test_cron_2', '0 0 * * * *', function () {});. Can you print the complete stack trace?

from cron.

lokielse avatar lokielse commented on July 16, 2024
19. RuntimeException
…/­vendor/­mtdowling/­cron-expression/­src/­Cron/­CronExpression.php321
18. Cron\CronExpression getRunDate
…/­vendor/­mtdowling/­cron-expression/­src/­Cron/­CronExpression.php157
17. Cron\CronExpression getNextRunDate
…/­vendor/­mtdowling/­cron-expression/­src/­Cron/­CronExpression.php252
16. Cron\CronExpression isDue
…/­vendor/­liebig/­cron/­src/­Liebig/­Cron/­Cron.php219
15. Liebig\Cron\Cron run
…/­workbench/­pay/­union/­vendor/­illuminate/­support/­Illuminate/­Support/­Facades/­Facade.php205
14. Illuminate\Support\Facades\Facade __callStatic
…/­app/­routes.php32
13. Liebig\Cron\Facades\Cron run
…/­app/­routes.php32

from cron.

lokielse avatar lokielse commented on July 16, 2024

laravel config app.php

  'timezone'   => 'PRC',

php.ini

date.timezone = PRC

from cron.

liebig avatar liebig commented on July 16, 2024

Seems to be a timezone problem. Please try to change laravels timezone to UTC.

from cron.

lokielse avatar lokielse commented on July 16, 2024

Yeah! solved.

I should use timezone PRC, but php5.5.15 may not support PRC

I use Asia/Shanghai instead and it works!!!

hahaha ;D

from cron.

lokielse avatar lokielse commented on July 16, 2024

thanks @liebig

from cron.

liebig avatar liebig commented on July 16, 2024

I am glad to hear this :) You are always welcome, @lokielse!

from cron.

lokielse avatar lokielse commented on July 16, 2024

http://php.net/manual/en/timezones.others.php

here is a warning.

Warning

Please do not use any of the timezones listed here (besides UTC), they only exist for backward compatible reasons.

from cron.

iClosedz avatar iClosedz commented on July 16, 2024

Hello,
I have question

So it need to add time zone in
laravel config app.php

'timezone'   => 'Asia/Shanghai',

and php.ini

date.timezone = Asia/Shanghai

or only in the laravel config app.php ?

Thank you.

from cron.

lokielse avatar lokielse commented on July 16, 2024

Both better while I changed only laravel config

from cron.

iClosedz avatar iClosedz commented on July 16, 2024

OK Thank you.

I have a little bit confuse about this cron package but I will create a new issue.

from cron.

Related Issues (20)

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.