I have a python application that uses a twisted structure.
I use the value stored in the pidfile generated by the twist. Launcher script checks for the presence and will not start the daemon process if the pidfile already exists.
However, twistd does not remove .pidfile when it receives a SIGKILL signal. This makes the script launcher assume that the daemon is already running.
I understand that the correct way to stop the daemon would be to use the SIGTERM signal, but the problem is that when the user who started the daemon logs out, the daemon never receives the SIGTERM signal, so it seems that it was killed by SIGKILL . This means that when the user logs out, he will never be able to start the daemon again, because the pidfile still exists.
Is there any way to delete this file in such situations?
source share