当前位置: 首页 > 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命令重启进程。

http://www.dtcms.com/a/50836.html

相关文章:

  • 一、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中的数据变化时,如何监听这些变化
  • 20250304vue-事件处理
  • JavaScript 编译原理
  • SQL AND OR 操作符详解
  • CSS—重绘与重排:10秒掌握重绘与重排
  • 三维数据可视化与表面重建:Marching Cubes算法的原理与应用
  • 大模型提示词推理架构对比:ReAct/CoT/ToT
  • 【TCP/IP协议栈】【传输层】端口号、套接字、多路复用/分解、网络字节序
  • 基于51单片机的汽车照明控制系统proteus仿真
  • 用OpenCV写个视频播放器可还行?(Python版)
  • 计算机毕设-基于springboot的拖恒ERP-物资管理系统的设计与实现(附源码+lw+ppt+开题报告)