avatar
Use scheduled task in Plesk UI using crontab Laravel

> Be assumption that the Laravel project was built and deployed in Plesk, we will create a new custom command as below:

php artisan make:command SystemSitemap

Note: the name and signature of the console command

protected $signature = 'command:sitemap';

> Run command from the local machine

php artisan command:sitemap

> Configure Schedule Task in Laravel project, let's make an adjustment in App\Console\Kernel.php

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

    /**
     * Define the application's command schedule.
     *
     * @param Schedule $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        $schedule->command('command:sitemap')->cron('* * * * *');
    }

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

> Hence, to get started with the schedule, you can run the following command below:

php artisan schedule:run

> Navigate to the Plesk panel and tab to Websites and Domains

Scheduled Tasks' Settings

Create and configure a custom Task

24
create Laravel project with composer and specific version
You need to login to do this manipulation!