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

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.kler.cn/a/570034.html

相关文章:

  • CSS - 妙用Sass
  • shell脚本编程实践第6天
  • 高性能采集服务上线回顾
  • React 各模块相关全面面试及答案解析
  • 毓恬冠佳即将登陆资本市场,深耕汽车天窗领域,引领行业创新发展
  • [MySQL初阶]MySQL(1)MySQL的理解、库的操作、表的操作
  • MySQL深分页如何优化?
  • IDEA 2025最新版2024.3.3软件安装、插件安装、语言设置
  • c语言中return 数字代表的含义
  • 探秘基带算法:从原理到5G时代的通信变革【一】引言
  • 第三百七十二节 JavaFX教程 - JavaFX HTMLEditor
  • 【HDLbits--FSM续(二)】
  • 搭建iOS逆向开发环境 (下) - 越狱设备与高级工具配置
  • 蓝桥杯4T平台(串口控制LD状态)
  • 【Java项目】基于vue的地方美食分享系统
  • Spring配置文件
  • iPhone 镜像 连接错误
  • 2024 ChatGPT大模型技术场景与商业应用视频精讲合集(45课).zip
  • 51单片机课综合项目
  • 京准电钟:NTP校时服务器于安防监控系统应用方案