phplaravelsupervisord

Laravel Supervisor "could not open file: artisan" error


So I'm running supervisor in background in my production server to do two things:

  1. php artisan queue:work
  2. php artisan schedule:work

The problem is that queue work is working fine, but the schedule work throws "could not open file: artisan" error!

Here's my supervisor conf:

[program:influencer-queue-worker]
process_name=%(program_name)s_%(process_num)02d
command=php8.1 /home/scodus/domains/influencer.scodus.com/public_html/artisan queue:work --sleep=3 --tries=1
autostart=true
autorestart=true
user=scodus
numprocs=1
redirect_stderr=true
stdout_logfile=/home/scodus/domains/influencer.scodus.com/queue.log

[program:influencer-schedule-worker]
process_name=%(program_name)s_%(process_num)02d
command=php8.1 /home/scodus/domains/influencer.scodus.com/public_html/artisan schedule:work
autostart=true
autorestart=true
user=scodus
numprocs=1
redirect_stderr=true
stdout_logfile=/home/scodus/domains/influencer.scodus.com/schedule.log

Here's my Console/Kernel.php

protected function schedule(Schedule $schedule)
    {
        $schedule->command('inspire')->everyMinute()->sendOutputTo(storage_path('logs/inspire.log'));
        $schedule->command('order:revenue-pending-to-available')->everyMinute();
        $schedule->command('order:cancel-without-requirements')->everyMinute();
        $schedule->command('order:autocomplete-delivery-attempted-orders')->everyMinute();
    }

Solution

  • This could be because your artisan file does not exist or the path to the artisan file is incorrect.

    In your supervisor config file, the command execution path does not seem to be correct

    command=php8.1 /home/scodus/domains/influencer.scodus.com/public_html/artisan