3

every thing works fine till 31 decemeber 2020 and in new year my cron job stoped working i dont know what happend i am using spatie laravel package to take db backup an i also have one other cron job in console and command kernal.php

`<?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
    /**
     * The Artisan commands provided by your application.
     *
     * @var array
     */
    protected $commands = [
        'App\Console\Commands\UpdateUserNotNew',
        
    ];

    /**
     * Define the application's command schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        // $schedule->command('inspire')
        //          ->hourly();
        $schedule->command('cron:update-user-not-new')->everyMinute();
        $schedule->command('backup:run')->everyMinute();
        $schedule->command('backup:clean')->everyMinute();
    }

    /**
     * Register the commands for the application.
     *
     * @return void
     */
    protected function commands()
    {
        $this->load(__DIR__.'/Commands');

        require base_path('routes/console.php');
    }
}`

my issue is resolved byhttps://stackoverflow.com/a/65890784/14913109 only my php version was not integrated with php multimanager

Hamza Qureshi
  • 172
  • 2
  • 20

1 Answers1

2

The problem is most likely not coming from spatie/laravel-backup package. To run Laravels cronjob you need to a have a central call in your crontab to Laravels scheduler

* * * * * cd /path-to-your-project && php artisan schedule:run

You can also check all the scheduled tasks locally by running

$ php artisan schedule:work

and if they run fine locally then there is an issue with your server, but not with Laravel.

Also always have a look at storage/logs/laravel.log if there are any errors showing up.

codedge
  • 4,754
  • 2
  • 22
  • 38
  • i seen my storage/logs/laravel.log goes to 135mb and my disk usage on cpanel is 100 persent o u think it cause an issue? – Hamza Qureshi Jan 24 '21 at 13:48
  • You should definitely debug all the error showing up in the log. Having that big error log does not mean anything good. Furthermore having a 100 percent disk usage is not a good sign as well. But this is surely out of scope of this question here. – codedge Jan 24 '21 at 13:54
  • 1
    it has old error history since the project is started now first i will clear log – Hamza Qureshi Jan 24 '21 at 13:58