Reputation: 143
I have laravel schedule setup as below
Create command and name its.
class BackupDatabase extends Command{
protected $signature = 'command:backupdatabase';
Register command in kernel.php
protected $commands = [
Commands\BackupDatabase::class
Setup handle
Artisan::call('backup:run',['--only-db'=>true]);
$output = Artisan::output();
Add to schedule
$schedule->command('command:backupdatabase')->everyMinute();
Nothing happen on this schedule. Btw, I already tried 'php artisan command:backupdatabase' in terminal and function working perfectly. I'm not sure what I'am doing wrong, Thanks for all advise.
Upvotes: 1
Views: 1714
Reputation: 102
You have to set up the crontab
* * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1
Laravel scheduled tasks work becouse the system is scheduled to execute the laravel command "schedule:run" that itself take care of executing the laravel scheduled command on the right time.
Upvotes: 2