def _check_semaphore_file(cls, file_name):
""" Evaluates if a specific either backup or restore operation is in execution
Args:
file_name: semaphore file, full path
Returns:
pid: 0= no operation is in execution or the pid retrieved from the semaphore file
Raises:
"""
_logger.debug("{func}".format(func="check_semaphore_file"))
pid = 0
if os.path.exists(file_name):
pid = cls._pid_file_retrieve(file_name)
# Check if the process is really running
try:
os.getpgid(pid)
except ProcessLookupError:
# Process is not running, removing the semaphore file
os.remove(file_name)
_message = _MESSAGES_LIST["e000002"].format(file_name, pid)
_logger.warning("{0}".format(_message))
pid = 0
return pid
评论列表
文章目录