I've asked this question more or less before on stackoverflow and believed it to be solved (hence accepted the answer) but it turns out it wasnt solved. :-(
In simple terms, I've written a python script which just outputs text constantly to stdout, thats all it does 24/7. I've linked it to this xinetd file
service myservice
{
instances = 1
port = 887
socket_type = stream
type = UNLISTED
wait = no
user = nobody
server = /usr/local/bin/myscript.py
only_from = 127.0.0.1 192.168.1.2
disable = no
max_load = 5.0
nice = 5
per_source = 1
}
This works fine in as much as when a client connects it starts spewing out text on their console. The problem is when the client disconnects, the process launched stays open, blocking the port. There is only one client allowed (instances = 1) but this can occur when the client reboots while connected.
Previously I thought this was because the python script was ignoring kill signals (which it was) but with this fixed, the same behaviour is observed. To clarify, kill -1 etc is now happily observed by the python script.
I'm assuming this is a xinetd issue and fairly simple to fix ?