一旦启动就停止Laravel计划的命令吗? [英] Stop a Laravel scheduled command once started?
问题描述
我已经为laravel 5.1项目设置了计划的命令.
I have set up a scheduled command for a laravel 5.1 project.
它有效,命令已经启动,但是愚蠢的我没有考虑如何停止它.
It works, the command has started, but rather foolishly I didn't think about how I might stop it.
通常您不想停止它,但是该命令正在将近一百万行插入数据库表中,而我只想确保无需登录服务器就可以启动它.
Normally you wouldn't want to stop it, but the command is inserting nearly half a million rows into a database table, and I only really wanted to make sure I could start it without being logged into the server.
我显然需要在某个时候运行它,但现在不行,那么有没有办法停止命令中流?
I will obviously need to run it at some point but not right now, so is there a way to stop the command mid-flow?
推荐答案
在我发现计划的代码中存在错误之后,这对我来说很有效,而且它将持续运行很长时间.SSH进入服务器.
This worked for me after I found a fault in my scheduled code and it was going to keep running for a really long time. SSH into the server.
ps -fe | grep artisan
然后杀死PID(PID是进程号).杀死前两个结果对我有用.
then kill PID (PID being the number of the process). Killing the first two results worked for me.
注意:如果使用的是withoutOverlapping(),则除非将-> name()更改为唯一的内容,否则该过程将不会再次启动.
Note: If you are using withoutOverlapping() the process will not start up again unless you change the ->name() to something unique.
这篇关于一旦启动就停止Laravel计划的命令吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!