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

biniyam20's avatar

How to run scheduler in forge?

Hi,

The video on scheduling tasks in Forge is outdated as Forge does not have a scheduler specific view. https://laracasts.com/series/learn-laravel-forge/episodes/11

So my question is how do I specify to forge that I want to run the schedule: run command, every minute for example?

Is it as simple as putting the following code in my deploy script?

php artisan schedule:run

If so, why is that the case? Does Forge under the hood check my Kernel app looking for tasks to run and then when I redeploy code, the Kernel gets updated and Froge keeps checking. Is that more or less it.

Also, how would I modify how often I want the scheduler to check for tasks? I've already defined all of my scheduling logic in my Kernel class just not sure how to run the scheduler...

Any help would be appreciated!

0 likes
9 replies
Nash's avatar

You can add scheduled jobs under Server Details -> YOUR SERVER -> Scheduler, e.g. php /home/forge/your-site/artisan schedule:run

1 like
biniyam20's avatar

I didn't realize the schedule was underneath the servers tab. Thank you.

biniyam20's avatar

As a follow up, @nash maybe you can answer this - what's the relationship between defining the schedule for commands in my Kernel class and the schedule:run scheduling?

For example, if I have php /home/forge/your-site/artisan schedule:run occur once a month, but one of my commands - command A - in the scheduler has ->everyMinute on it. Does that mean command A will run every minute or does it need php /home/forge/your-site/artisan schedule:run to run at least every minute then?

I tried it locally, and it seems like the latter is true. I had to run php artisan schedule:run multiple times to have my command A execute multiple times - commandA didn't just run everyMinute after the first schedule:run artisan command.

Is the only benefit of the timing method on the actual command in the kernel class that if we run the schedule:run every minute, then the command in the kernel class will stick to the schedule chained to it like ->daily() or something?

1 like
biniyam20's avatar

Got it @cronix ! Thank you!

Last question, when scheduling a new job the default command is

php /home/forge/default/artisan schedule:run

I'm assuming that works fine for my default site because my site's name is just 'default' but to add a new job for my other site whose url is

NEXTDORM.COLLEGE

would i do something like this instead to account for the site name difference?

php /home/forge/nextdorm/artisan schedule:run
OR
php /home/forge/nextdorm.college/artisan schedule:run

Thank you in advance!

1 like
Cronix's avatar

Yes, it's whatever the actual path is to laravel for each site. If you ssh into the server and check the /home/forge dir, you'll see them.

raf_'s avatar

This works for me! go project path and run the artisan command

cd /home/forge/default && php artisan schedule:run

cyb3rk1d's avatar

Hi just to add on to what's been said, you can get more control by defining commands and adding them to your scheduler in the 'routes\console.php'. I am using Laravel 11 and 12, should work just fine.

//Add class to existing code
use App\Console\Commands\ExampleCommand;

Schedule::command(ExampleCommand::class)->everyTenSeconds();

Then on the forge interface in site settings under the "Application" tab, enable the "Laravel Scheduler". Noticed there is a bit of a delay when moving to the next minute, e.g Logging time moves from

[2025-03-03 08:47:40]
[2025-03-03 08:47:50]
[2025-03-03 08:48:01]
[2025-03-03 08:48:10]
[2025-03-03 08:48:20]
[2025-03-03 08:48:30]

Let me know what you think.

Snapey's avatar

@cyb3rk1d You might have other scheduler work that needs to run before this command

Please or to participate in this conversation.