Answer the question
In order to leave comments, you need to log in
Schedule not working in Docker?
laravel running in docker
Previously everything worked when starting the container the following script is run
if [ "$APP_ROLE" = "app" ]; then
echo "App role"
#php /var/www/artisan migrate
elif [ "$APP_ROLE" = "cron" ]; then
echo "Cron role"
while [ true ]
do
#php /var/www/artisan schedule:run --verbose --no-interaction &
php artisan job:dispatch ProcessParser
php artisan job:dispatch ProcessParser &
sleep 10
php artisan job:dispatch checkTestimony
php artisan job:dispatch checkTestimony &
sleep 10
php artisan job:dispatch SenderSms
php artisan job:dispatch SenderSms &
sleep 60
done
else
echo "Could not match the container role \"$APP_ROLE\""
exit 1
fi
<?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use App\Jobs\ProcessParser;
use App\Jobs\checkTestimony;
use App\Jobs\SenderSms;
use App\Jobs\ClearingOldReadings;
use Illuminate\Support\Facades\Log;
class Kernel extends ConsoleKernel
{
protected function schedule(Schedule $schedule)
{
echo "run schedule";
Log::info("run schedule");
$schedule->job(new ClearingOldReadings)->daily();
$schedule->job(new ProcessParser)->everyTwoMinutes();
$schedule->job(new checkTestimony)->everyTwoMinutes();
$schedule->job(new SenderSms)->everyMinute();
}
protected function commands()
{
$this->load(__DIR__.'/Commands');
require base_path('routes/console.php');
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question