当前位置: 首页 > news >正文

Linux查看TP6 command定时任务并重启

TP6定时任务设置:

1、在项目根目录/app/command 目录下创建定时任务类文件MemberSubmit.php

       使用 $this->setName('memberSubmit')  方法设置名称为 memberSubmit 的定时任务。

namespace app\command;

use think\console\Command;
use think\console\Input;
use think\console\Output;
use think\Exception;

class MemberSubmit extends Command
{
    public $log_path;

    protected function configure()
    {
        // 指令配置
        $this->setName('memberSubmit')
            ->setDescription('解压用户提交资料');
    }

    protected function execute(Input $input, Output $output)
    {
        //此处为定时任务程序代码  任务逻辑
        $output->writeln('MemberSubmit task executed!');
        
    }
}

Linux下查看定时任务:

ps -ef|grep Submit

ps aux|grep memberSubmit

执行以上命令,查询linux下含有“Submit”字符的进程。如列出memberSubmit信息,则说明此定时任务进程存在。如下所示:

[root@test myweb]# ps -ef|grep Submit
root     10515 10513  0 13:08 ?        00:00:00 php think memberSubmit
root     18789 18724  0 15:18 pts/3    00:00:00 grep --color=auto Submit
[root@test myweb]# ps aux|grep memberSubmit
root     10515  0.0  0.3 305076 13660 ?        S    13:08   0:00 php think memberSubmit
root     18949  0.0  0.0 112832   992 pts/3    S+   15:21   0:00 grep --color=auto memberSubmit

其中 10515 为 memberSubmit 定时任务的pid号。

如要重启进程,可执行以下命令:

kill -9 10515

php think memberSubmit

先杀掉旧的进程pid,再执行php think memberSubmit命令重启进程。

相关文章:

  • 一、Prometheus架构
  • table 拖拽移动
  • 广域互联网关键技术详解(GRE/LSTP/IPsec/NAT/SAC/SPR)
  • 文件上传复现
  • Office 2021 Mac Office办公
  • 【银河麒麟高级服务器操作系统实际案例分享】数据库资源重启现象分析及处理全过程
  • HTML5+CSS3+JS小实例:带缩略图的焦点图
  • vue组合式API中prop
  • 深入 Vue.js 组件开发:从基础到实践
  • 《张一鸣,创业心路与算法思维》
  • 准确--Centos最小化安装通过命令去修改ip和dns
  • 本地部署Dify及避坑指南
  • 【powerjob】 powerjobserver注册服务IP错误
  • uniapp+vue3搭建项目
  • ESP32-P4 支持哪些 RISC-V 汇编指令?
  • 前缀和矩阵
  • 人工智能技术的广阔前景
  • verilog 基本语法结构与定义
  • Python递归进阶——科赫雪花
  • localStorage中的数据变化时,如何监听这些变化
  • 易云巢做网站公司/百度识图以图搜图
  • 最好记得网站域名/河北关键词seo排名
  • 代运营3000一个月靠谱吗/西安网站seo服务
  • 90后做网站月入万元/推广关键词优化公司
  • 免费做app和网站的平台有哪些/西安seo和网络推广
  • 沧州什么网最好/佛山旺道seo