H:ju# d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlm Z d dl mZmZ d dlm Z mZ d dlmZ dZda G d d e Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Z dS ) N)reboot_lock)configdbengine)LVEVersionErrorget_lve_version) setup_loggingz /dev/null c e Zd Z fdZ xZS )EnvironmentExceptionc V t || _ d S )N)super__init__message)selfr __class__s /builddir/build/BUILDROOT/lve-stats-5.0.4-1.el8.x86_64/opt/cloudlinux/venv/lib/python3.11/site-packages/lvestats/lib/lvestats_server.pyr zEnvironmentException.__init__ s$ )__name__ __module____qualname__r __classcell__)r s @r r r s8 r r c t rt j t r t t dd 5 } t | }t j |d |cddd S # 1 swxY w Y dS # t t f$ r Y dS w xY wdS dS )z Check if lvestats already running :return int|None: None - if no process found; pid - if some lvestats-server found rutf-8)encodingr N)PIDFILEospathisfileopenintreadstripkillIOErrorOSError)fpids r get_process_pidr) s 27>>'** gsW555 !&&((..**++Q ! 44 s6 B( A BB( BB( "B#B( (B=<B=c $ d} dt dt j ffd}dt j ffd}dt j ffd}t i d t }|d } n*t j | }| d }t d 5 |D ]6}t j |j r ||j t j 7t j |d| \ }} | D ]} || j t j t j |d| \ }} ||t j t j d | D ]} ||j t j d d d n# 1 swxY w Y | S )Nr _pid_signalc t j | | dS # t t f$ r d| Y dS w xY w)z6Kill process by pid by sending a specific signal to itz%Process with pid '%d' is already deadN)r r$ r&