简体   繁体   English

从终端停止python脚本

[英]stop python script from terminal

I have an android app and a raspberry pi. 我有一个Android应用程序和一个树莓派。 I create connections via ssh between them. 我通过它们之间的ssh创建连接。 I send commands from my android app to the rpi and these commands typically run python scripts. 我从Android应用程序向rpi发送命令,这些命令通常运行python脚本。

My plan is the following: As long as my phone is in a specified radius regarding to the gps coordinates, I'd like to run python scripts. 我的计划如下:只要我的手机处于关于gps坐标的指定半径内,我想运行python脚本。 If I1m out of that radius, I'd like to stop that python script. 如果I1m超出该半径,我想停止该python脚本。 How can I stop a running python script from terminal/cmd? 如何从Terminal / cmd停止正在运行的python脚本?

Thanks 谢谢

You can stop EVERY python script by wunning the command 您可以通过运行以下命令来停止每个python脚本

sudo killall python

in the terminal. 在终端。 Killing individual scripts will require the PID of the python script you wish to stop. 杀死单个脚本将需要您要停止的python脚本的PID。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM