Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

rubol's avatar
Level 2

Task scheduling in laravel forge

I've hosted my app in Digital Ocean with Laravel Forge and have created a artisan command to run through schedule [Nightly].

The artisan command runs smoothly via terminal but returns No such file or directory while running it through Scheduled Jobs from Laravel Forge.

The command for the job is:

php /home/forge/sitename.com/artisan Instagram:fetch

The artisan command php /home/forge/sitename.com/artisan Inspire i.e php artisan inspire returns the correct output while the above mentioned custom artisan returns No such file or directory

0 likes
1 reply
aurawindsurfing's avatar

Hi,

To use you command you need to first register your command in app/Console/Kernel.php

 protected $commands = [
        \App\Console\Commands\Instagram::class,
    ];

also the name of artisan command should not start from capital letter I think Instagram:fetch

then in your scheduler:

protected function schedule(Schedule $schedule)
    {
        $schedule->command('instagram:fetch')->timezone('Europe/Dublin')->daily();
    }

Then you need to start at least one artisan worker on your forge machine

and also might be good idea to add this to your deployment script:

php artisan queue:restart

to make sure workers are working off you latest deployed code.

Please or to participate in this conversation.