J-Rios / TLG_JoinCaptchaBot

Telegram Bot to verify if users joining a group are human. The Bot sends an image captcha for each new user and kicks any of them who can't solve the captcha in a specified time.
GNU General Public License v3.0
532 stars 218 forks source link

Fix kill script not working because of wrong signal #56

Closed LocutusOfBorg closed 4 years ago

LocutusOfBorg commented 4 years ago

The kill command should send either -9 or -15 to stop the process, instead of -0 There is no signal 0 in unix.

J-Rios commented 4 years ago

Hi, note that this is just to check if process is still running or has been killed. The script send a SIGTERM signal and then wait until process is killed through -0.

From kill(2) manual:

"If sig is 0, then no signal is sent, but existence and permission checks are still performed; this can be used to check for the existence of a process ID or process group ID that the caller is permitted to signal."

LocutusOfBorg commented 4 years ago

why does it not exit then? how long does it take for the script to exit?

J-Rios commented 4 years ago

However it is true that kill script is not working, but seems related to Python-Telegram-Bot framework catching the signal before our code handler... A forcekill script has been added to send SIGKILL while the normal kill issue is solved.

LocutusOfBorg commented 4 years ago

thanks!

J-Rios commented 4 years ago

Fixed by making Bot idle without using python-telegram-bot idle function :)