当前位置:网站首页>Laravel task scheduling
Laravel task scheduling
2022-06-25 12:34:00 【qq_ twenty-five million sixty thousand seven hundred and sixty-】
First, start task scheduling
adopt
crontab -eTo add or edit scheduled tasks , adoptcrontab -lView existing scheduled tasks* * * * * / Yours php The location of /php / Your project location /artisan schedule:run >> /dev/null 2>&1
Define scheduling
php artisan make:command Test \\App\Console\Commands\Test.php
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Foundation\Inspiring;
use Log;
class Test extends Command {
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'test'; // Command name
/**
* The console command description.
*
* @var string
*/
protected $description = ' Task test '; // Command description
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
Log::info('66666');
}
}app/Console/Kernel.php file
<?php namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel {
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
\App\Console\Commands\Test::class,
];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
$schedule->command('test') //Test.php Medium name
->everyMinutes(); // Execute every minute
}
}Scheduling common options
| Method | describe |
|---|---|
->cron('* * * * *'); | In the custom Cron Running tasks on a schedule |
->everyMinute(); | Run the task every minute |
->everyFiveMinutes(); | Run the task every five minutes |
->everyTenMinutes(); | Run the task every ten minutes |
->everyFifteenMinutes(); | Run the task every 15 minutes |
->everyThirtyMinutes(); | Run the task every 30 minutes |
->hourly(); | Run the task every hour |
->hourlyAt(17); | Run the task every seventeen minutes of the hour |
->daily(); | Run the mission at 0 a.m. every morning |
->dailyAt('13:00'); | Every day 13:00 Run the task |
->twiceDaily(1, 13); | Every day 1:00 & 13:00 Run the task |
->weekly(); | Run the task once a week |
->monthly(); | Run the task once a month |
->monthlyOn(4, '15:00'); | monthly 4 Number 15:00 Run a task |
->quarterly(); | Run Quarterly |
->yearly(); | Run once a year |
->timezone('PRC'); | Set time zone |
边栏推荐
- The first techo day Tencent technology open day in 2022 will be held online on June 28
- Dark horse shopping mall ---1 Project introduction - environment construction
- Zhangxiaobai's way of penetration (VIII) - detailed operation steps of SQL injection - Boolean blind injection of blind injection
- Today, I will explain to you what is DFI and its development prospects
- [regression analysis] understand ridge regression with case teaching
- Image tagging to obtain the coordinates of the image in the ImageView
- Learning notes 2022 overview | automatic graph machine learning, describing AGML methods, libraries and directions
- PHP files running online
- JS monitors the width and height changes of div
- Zhangxiaobai's way of penetration (III) -- detailed explanation of SQL injection vulnerability principle (SQL Server)
猜你喜欢

Linear regression of common mathematical modeling models for College Students

15、wpf之button样式小记

Understanding and construction of devsecops and Devops

Flutter common commands and problems

What is the primordial universe

揭秘GaussDB(for Redis):全面对比Codis
![[oceanbase] Introduction to oceanbase and its comparison with MySQL](/img/1c/bd2bcddb7af4647407d2bc351f5f5d.png)
[oceanbase] Introduction to oceanbase and its comparison with MySQL

19. Implementation of MVVM architecture based on WPF event to command

Upgrade opsenssh to 8.8p1

Explain factor analysis in simple terms, with case teaching (full)
随机推荐
ECSHOP product attribute color specification size stock item No. automatic combination
Repair the error that ECSHOP background orders prompt insufficient inventory when adding goods. Please reselect
How to use ARIMA model for prediction?
apple 为什么要改 objc_msgSend 的类型申明
Hook technology
PHP multidimensional array sorting
Why should Apple change objc_ Type declaration for msgsend
Kotlin Foundation
ECSHOP whole site custom URL supports directory type
Controllable character image synthesis based on attribute decomposition and Gan reproduction
Polling and long polling
Dark horse shopping mall ---6 Brand, specification statistics, condition filtering, paging sorting, highlighting
High imitation blue playing network disk file sharing to make money network disk PHP system source code
The R language uses the follow up The plot function visualizes the longitudinal follow-up map of multiple ID (case) monitoring indicators, and uses stress The type parameter specifies the line type of
15. Notes on the button style of WPF
Set the transparency of the picture to gradient from left to right
[regression analysis] understand ridge regression with case teaching
【数据中台】数据中台的OneID是个什么鬼,主数据它不香吗?
Heyangdao store management system -- share the development source code of heyangdao system
ARM V7 ldr str 内存访问