Home/Support/Support Forum/how to kill a python script running in gateway?
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

how to kill a python script running in gateway?

0 votes
I am new Digi python programming , I have following question about python script ..

Please help me

1. I have upload a python script with web browser to gateway , and runnning it with telnet command, python ***.py, But this script file is a while loop that run forever, if I want to kill it for modify , what shoud I do ? Using another telnet
connect to the gateway with kill command ?

2. is there a vi editor inside the gateway ? , when I using
telnet , I can not use vi in this box
asked Jul 22, 2009 in Python by john01 New to the Community (2 points)

Please log in or register to answer this question.

5 Answers

0 votes
1. There is not a way built into the system to kill scripts that are running. However, for debugging purposes at least, it's usually not to hard to build into the script itself a way to cause it to exit. What some of the demo apps do is place listen socket on a port, and cause the script to exit if they receive a connection on that port. Certainly not something that you want to leave in a final product, but adequate for testing.

2. There is no editor in the box. You'll have to edit your scripts on another machine and then upload them.
answered Jul 22, 2009 by DigiGuy42 Community Contributor (102 points)
0 votes
On the X4 under Management/Connections each excuting python script shows up as an active system connection. The UI provides a mechanism to select one and delete it however I have not had any success with this.

Either I am not using this correctly or there is a bug in the GW software.
answered Jul 22, 2009 by deancs New to the Community (10 points)
0 votes
>>What some of the demo apps do is place listen socket on a port, and cause the script to exit

Hi GigiGuy42,
Could you post some demo code for this ?! Or where I can get it ?!

Thank you
answered Jul 23, 2009 by john01 New to the Community (2 points)
0 votes
Hi,

http://www.digi.com/wiki/developer/index.php/TCP_to_Zigbee_Dynamic_Name_Mapping#Quit_socket_in_read_list

http://www.digi.com/wiki/developer/index.php/Card_Swipe_Demo#Main_loop:_Quit_socket_reading

The previous two examples show how you can use a listening socket to terminate an application when it receives a connection at a particular port.

I attached a simple example that demonstrates one way of doing it. The attached script has a loop that does a print out to the console until a socket connection is opened on port 32000.

Chris
answered Jul 23, 2009 by cpopp Seasoned Professional (151 points)
0 votes
Python threads are listed for informational purposes. They can not be killed with either the "kill" CLI command or via the connection management in the webUI.
answered Jul 23, 2009 by 52637p Community Contributor (59 points)
...