how to kill a python script running in gateway?

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

  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.

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.

>>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

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

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.