Skip to content

Commit

Permalink
chore: add cronjob
Browse files Browse the repository at this point in the history
  • Loading branch information
flemming-pr committed Aug 9, 2023
1 parent 80fe72b commit df52cfd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ RUN rm -rf node_modules

RUN chmod +x /var/www/html/docker/entrypoint.sh

RUN echo "* * * * * cd /var/www/html && php artisan schedule:run >> /dev/null 2>&1" >> /var/spool/cron/crontabs/root

EXPOSE 9000

ENTRYPOINT ["bash", "/var/www/html/docker/entrypoint.sh"]
CMD php artisan serve --host=0.0.0.0 --port=9000 && php artisan queue:work --tries=3
CMD crond && php artisan serve --host=0.0.0.0 --port=9000 && php artisan queue:work --tries=3
2 changes: 2 additions & 0 deletions app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use Illuminate\Support\Facades\Log;

class Kernel extends ConsoleKernel
{
Expand All @@ -14,6 +15,7 @@ protected function schedule(Schedule $schedule): void
{
$schedule->command('simple-borrow:send:reminder')->dailyAt('08:00');
$schedule->command('simple-borrow:send:overdue')->dailyAt('08:00');
$schedule->log('info', 'Scheduled commands executed.');
}

/**
Expand Down

0 comments on commit df52cfd

Please sign in to comment.