您的位置:首页 > 新闻 > 热点要闻 > 西宁网站建设优化案例_南昌做小程序公司_深圳网络营销推广_重庆seo推广公司

西宁网站建设优化案例_南昌做小程序公司_深圳网络营销推广_重庆seo推广公司

2025/3/11 19:01:56 来源:https://blog.csdn.net/luoluoyu2013/article/details/145989481  浏览:    关键词:西宁网站建设优化案例_南昌做小程序公司_深圳网络营销推广_重庆seo推广公司
西宁网站建设优化案例_南昌做小程序公司_深圳网络营销推广_重庆seo推广公司

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命令重启进程。

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com