Git Product home page Git Product logo

Comments (10)

liebig avatar liebig commented on July 24, 2024

Hi herodev777,
thanks for using Cron. Can you post the complete error message with stack trace when you call Cron from command? I don't get an error exception if I call php artisan cron:run from the laravel directory.
Cron tries to prevent overlapping by default. On windows machines, the created lock file cannot be deleted. This is a problem with the windows user management. So Cron thinks that still a Cron instance is running (because the cron.lock files is still there) and returns runtime -1. So please disable the overlapping protection by calling Cron::setDisablePreventOverlapping(); before calling the run method or change the config value 'preventOverlapping' => false,. Additionally please delete the cron.lock file from your storage directory.

Thanks
Marc

from cron.

herodev777 avatar herodev777 commented on July 24, 2024

thanks very mush sir, it now work with me fine when i go to url path "/cron/run/sdasdasdawq2323123".

but when i make command "php artisan cron:run"
show me this below
+------------+---------+----------+--------+------+
| Run date | In time | Run time | Errors | Jobs |
+------------+---------+----------+--------+------+
| 1400204634 | false | 0 | 0 | 0 |
+------------+---------+----------+--------+------+
is this error ? becuase my cron function didn't work with this command, my cron function change in database, cron function work when i go to url path directly.

can you please explain steps to install and run "liebig/cron" in video, this will be very usefully ?

and the README.md didn't explain how to use cron key ?

sorry for my english language, it is not my native language

thanks very mush

from cron.

liebig avatar liebig commented on July 24, 2024

I forgot to tell you, that if you use the build in brand-new command, you have to use an event listener to add your jobs. The best place to do this is the /path/to/laravel/app/start/global.php file.

/*
|--------------------------------------------------------------------------
| Cron job definitions
|--------------------------------------------------------------------------
*/
Event::listen('cron.collectJobs', function() {
    Cron::add('example1', '* * * * *', function() {
                    // Do some crazy things unsuccessfully every minute
                    return 'No';
                });

    Cron::add('example2', '*/2 * * * *', function() {
        // Do some crazy things successfully every two minute
        return null;
    });

    Cron::add('disabled job', '0 * * * *', function() {
        // Do some crazy things successfully every hour
    }, false);
});

Inside the anonymous function you can use all the Laravel and Cron functionality. This feature is really new and I am rewriting the README file at the moment. I will update it soon. If you use this event listener, you can delete your created route. Please let me know if this works. Thank you.

from cron.

herodev777 avatar herodev777 commented on July 24, 2024

show me this error
C:\xampp\htdocs\lara>php artisan cron:run

[ErrorException]
Missing argument 1 for {closure}()

cron:run

when i remove "$rundate" parameter work with me with this output

C:\xampp\htdocs\lara>php artisan cron:run
+------------+---------+----------+--------+------+
| Run date | In time | Run time | Errors | Jobs |
+------------+---------+----------+--------+------+
| 1400247245 | false | 0.0803 | 1 | 1 |
+------------+---------+----------+--------+------+

from cron.

liebig avatar liebig commented on July 24, 2024

I am sorry, you are right. There is no $rundate value anymore. That is the problem with brand new features. They are not fully tested.

from cron.

herodev777 avatar herodev777 commented on July 24, 2024

please tell me when problem solved.

thanks sir

from cron.

liebig avatar liebig commented on July 24, 2024

Which problem do you mean? The command works fine without the rundate parameter?

from cron.

herodev777 avatar herodev777 commented on July 24, 2024

you means i must remove $rundate parameter to command work ?

but when i run this command show me 1 Error in below table ?
What does this error mean ?

C:\xampp\htdocs\lara>php artisan cron:run
+------------+---------+----------+--------+------+
| Run date | In time | Run time | Errors | Jobs |
+------------+---------+----------+--------+------+
| 1400247245 | false | 0.0803 | 1 | 1 |
+------------+---------+----------+--------+------+

thanks

from cron.

liebig avatar liebig commented on July 24, 2024

This error means, that the Cron job you ran did not return null. In my example at the top, the Cron job with the name "example1" returns "No". This is not null and Crons expects that there was an error executing this job. With this feature you can log and handle error jobs. This is only an example and if there was no error while executing the job, you should return NULL.

from cron.

herodev777 avatar herodev777 commented on July 24, 2024

thanks you

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.