Articles in this section

How to enable scheduled tasks for Laravel project in Laravel Toolkit?

DoNotDelete:docref Plesk for Linux how-to

Question

How to enable scheduled tasks for the Laravel project in Laravel Toolkit? 

Answer

Note: Make sure the following pre-requirements are satisfied:

  • Laravel Toolkit version >= 1.2.x
  • Configure Scheduled tasks in Laravel application.

    For Laravel version <=10: The Scheduled tasks are defined in Kernel.php of the project, see Task Scheduling Laravel 10.x for more details

    For Laravel version >=10: For version 11 and latest, Scheduled tasks are defined in routes/console.php see Task Scheduling Laravel 12.x for more details

  • The version of Laravel is >= 8.19.x

Once pre-requirements are satisfied, follow these steps:

  1. Log into Plesk.
  2. Enable Scheduler management permission according to this Plesk guide.
  3. Set Access to the server over SSH to /bin/bash at Domains > example.com > Web Hosting Access page.

    In the scope of EXTPLESK-8895, the concept/logic of requiring SSH Shell access for Laravel Toolkit will be reworked in one of the future Plesk updates i.e. it should work without requiring any SSH shell access

  4. Navigate to Domains > example.com > Manage Laravel Application page and enable the Scheduled Tasks option.
Was this article helpful?

Comments

6 comments
Date Votes
  • Does not work. Scheduler and jobs are greyed out. Some time ago I found I had to do something regarding to the plan of service or similar, so I could activate another app on the same server. Yet it is not well documented and makes no real sense. Should be much easier. At the end , if I am not mistaken, it is simply a mater of creating a cron job that every minute sees if there is something in the queue to be done. That shouldn't be that complicated.

    2
  • Impossible to use, nothing works. Laravel 12+, PHP 8.4, no chance to activate Scheduled Tasks

    0
  • Laravel Toolkit – “Scheduled Tasks” and “Queue” toggles are coupled for one domain (can’t disable Laravel queue while keeping Scheduler enabled)

    0
  • Marc Werner  Thanks for your feedback. I updated the article, for Laravel version => 11 the scheduled tasks should first be added to routes/console.php instead of  Kernel.php of the project. Please check and see if this helps. 

    1
  • Atif Bangash can you provide a full sample for Laravel 12, i still can't get it work.

    0
  • Example: 
    Plesk version have to be 18 or above
    Laravel 12 and above
    Laravel Toolkit 1.5 and above

    On Laravel:
    - add in routes/console.php your schedule command.
    example: `Schedule::command('cmd:update')->daily();`

    On Plesk:
    - go to your Websites & Domains
    - open your Domain where Laravel Toolkit is running
    - got to tab: Hosting & DNS
    - Hosting Settings
    - Scroll down in the Settings to: SSH access → set to `/bin/bash`

    On Laravel Toolkit in Plesk:
    - on tab: Dashboard
    - Scheduled Tasks → can be enabled.
    - check tab: Scheduled Tasks (you have seen here the command from routes/console.php)

     

    if you seen your tasks in the tab “Scheduled Tasks” and Button can be enables it will worked :)

    1

Please sign in to leave a comment.