Comments (13)
Which version of Laravel are you using? Did you installed Cron as described in the manual?
from cron.
Laravel Framework 5.5.2
Installed as same in the documentation. Cron::add function is working fine for me and records are getting updated in cron_job and cron_manager.
One more issue i have
I want to make the cron function (Basic insert query for testing like inserting 10000 records in table) timeout after 30 sec of execution time. But script continue to run for 48 sec successfully. I want to store the timeout error in cron_job.
I made changes in etc/php/7.0/cli/php.ini file by changing max_execution_time= 3 and changing max_input_time=3. But then also cron continue to complete its script, is there any way i can put a timeout limit to cron::add or any other options u have
from cron.
Maybe this can help: How do you set max execution time of PHP's CLI component?
from cron.
This helped me thanks. It is generating a fatal error and that error is not getting stored in cron_job table.
Help me with this issue too
After running php artisan cron:run
It shows
PHP Warning: Module 'pgsql' already loaded in Unknown on line 0
[ReflectionException]
Method Liebig\Cron\RunCommand::handle() does not exist
After running any command list,run and keygen. i got the same error.
Completed Following steps.
Installing Fresh Laravel
laravel new cronproject
php artisan key:generate
creating database
changing env file with the DB details
php artisan migrate
Add "liebig/cron": "dev-master" to your /path/to/laravel/composer.json file at the "require": section (Find more about composer at http://getcomposer.org/)
Run the composer update liebig/cron --no-dev command in your shell from your /path/to/laravel/ directory
Add 'Liebig\Cron\Laravel5ServiceProvider' to your 'providers' array in the /path/to/laravel/config/app.php file
Migrate the database with running the command php artisan migrate --path=vendor/liebig/cron/src/migrations
Publish the configuration file with running the command php artisan vendor:publish - now you find the Cron configuration file at /path/to/laravel/config/liebigCron.php and this file won't be overwritten at any update
I am calling the cron from controller
http://127.0.0.1:8000/cron
Cron::add('CreateUser', '* * * * *', function() {
$cnt=5000;
$saved="";
for($i=0;$i<=$cnt;$i++) {
$user = new User;
$user->name = "tanmay" . rand();
$user->email = 'tanmay.sakhale' . rand() . '@gmail.com';
$user->password = 'password';
$saved = $user->save();
}
if(!$saved){
return "Error:421";
} else {
return "Success";
}
});
$report = Cron::run();
print_r ($report);
}
If i try it from AppServiceProvider by writing it on boot() function. How to call this cron automatically not having idea how to do this ??
Please help
from cron.
The Method Liebig\Cron\RunCommand::handle() does not exist
error seems to be a namespace problem, because Liebig\Cron\Run
does exist but Liebig\Cron\RunCommand
does not. So please check your code! Please have a look at the README how to use Cron's integrated route also.
from cron.
This is showing when i am typing the command
from cron.
Now my cron started running by the run command. I checked it in the cron_job table.
Just i am not able to see list command. I am doing print_r to see the list of cron jobs.
How to solve this ReflectionException
Thanks for your help
from cron.
Can you please test to rename (in vendor directory) cron/src/Liebig/Cron/ListCommand.php
line 37
public function fire() {
to
public function handle() {
and try the cron:list
command again?
Thank you.
from cron.
It started working. Thank you for the help.
from cron.
Okay, then we have to change all the fire
method names to handle
for the command files. A PR would be awesome.
from cron.
I added a Pull Request for this issue.
@tanmaysakhale24 Please have a look at it and test it. You can download the laravel-5.5 branch and extract it to your vendor directory (or only the three command files KeygenCommand.php
, ListCommand.php
and RunCommand.php
) and execute the commands. Thank you.
from cron.
I have tested the changes and they seem to work. PR is merged and closed.
from cron.
Ok I will try
from cron.
Related Issues (20)
- Are tests working? HOT 2
- Incompatibility with Laravel 8, 9 HOT 1
- Exception with two closures on the same line of code HOT 3
- Symfony\Component\Console\Helper\HelperSet->get('table') HOT 3
- usage question: loading jobs from database HOT 3
- command cron:run/list error HOT 1
- stop cronjob run during beforeRun event HOT 3
- Cron job running only one time HOT 3
- Pull request #80 not in composer package HOT 3
- trying to understand why I should use this over Laravel's built-in scheduler HOT 2
- Which user should run cron HOT 2
- Laravel 5.4 support HOT 3
- PHP Fatal error: Class 'App\Providers\Cron' not found in C:\xampp\htdocs\isend\blog\app\Providers\AppServiceProvider.php on line 33 HOT 3
- laravel5.2.45 install failed HOT 2
- passing variable to the function parameter before adding a cron HOT 5
- Have Undefined index while run the cron job!!! HOT 3
- Can't use `artisan route:cache` because the built-in cron route uses a closure HOT 5
- [Laravel 5.6] Ambiguous class resolution warning HOT 10
- doesn't work with Laravel 5.8 HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cron.