Commit 2c992327 authored by Devaev Maxim's avatar Devaev Maxim

Fixed daemon killing

parent 49e9e008
...@@ -13,6 +13,8 @@ import logger ...@@ -13,6 +13,8 @@ import logger
##### Private methods ##### ##### Private methods #####
def pidsListOfPythonProc(proc_name, without_options_list = [], uid = 0) : def pidsListOfPythonProc(proc_name, without_options_list = [], uid = 0) :
proc_name = os.path.basename(proc_name)
proc_pids_list = [] proc_pids_list = []
for proc_list_item in os.listdir("/proc") : for proc_list_item in os.listdir("/proc") :
try : try :
...@@ -102,7 +104,8 @@ def killDaemon() : ...@@ -102,7 +104,8 @@ def killDaemon() :
if len(pids_list) != 0 : if len(pids_list) != 0 :
for pids_list_item in pids_list : for pids_list_item in pids_list :
os.kill(pids_list_item, signal.SIGTERM) os.kill(pids_list_item, signal.SIGTERM)
logger.info("SIGTERM has been sended to %s process \"%s\" with pid \"%d\"" % (const.MY_NAME, sys.argv[0], pids_list_item)) logger.info("SIGTERM has been sended to %s process \"%s\" with pid \"%d\"" % (
const.MY_NAME, os.path.basename(sys.argv[0]), pids_list_item ))
else : else :
logger.error("Cannot determine a %s daemon process of \"%s\"" % (const.MY_NAME, sys.argv[0])) logger.error("Cannot determine a %s daemon process of \"%s\"" % (const.MY_NAME, os.path.basename(sys.argv[0])))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment