Skip to content

Commit

Permalink
Update installation-and-setup.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Geoffry304 authored and freekmurze committed Jul 2, 2024
1 parent 6e7f01f commit d859659
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/installation-and-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,16 @@ protected function schedule(Schedule $schedule)
}
```

Or for Laravel 11 or higher you just add them to the console routes file.
```php
// routes/console.php

use Illuminate\Support\Facades\Schedule;

Schedule::command('backup:clean')->daily()->at('01:00');
Schedule::command('backup:run')->daily()->at('01:30');
```

Of course, the times used in the code above are just examples. Adjust them to suit your own preferences. It is generally a good idea to avoid the timeslot between 02:00 and 03:00 at night in areas where daylight saving time changes occur, as this causes sometimes a double backup or (worse) no backup at all.

If a backup cannot be taken successfully, the `backup:run` command returns an exit code of 1 which signals a general error, so you can use laravel's task hooks to specify code to be executed if the scheduled backup succeeds or fails:
Expand Down

0 comments on commit d859659

Please sign in to comment.