관리-도구
편집 파일: lvestats_server.cpython-311.pyc
� �Cg�! � �� � 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)�config�dbengine)�LVEVersionError�get_lve_version)� setup_loggingz /dev/null� c � � � e Zd Z� fd�Z� xZS )�EnvironmentExceptionc �V �� t � � � � � || _ d S )N)�super�__init__�message)�selfr � __class__s ���/builddir/build/BUILDROOT/lve-stats-4.2.10-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 r�t 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 �r�utf-8��encodingr N)�PIDFILE�os�path�isfile�open�int�read�strip�kill�IOError�OSError)�f�pids r �get_process_pidr* s � � � �2�7�>�>�'�*�*� � ��g�s�W�5�5�5� ���!�&�&�(�(�.�.�*�*�+�+�����Q����� � � � � � � � � � � � ���� � � � � � �� ��!� � � ��4�4� ���� � � � s6 �B( �A B�B( �B�B( �"B�#B( �(B=�<B=c �$ �� d} dt dt j f�fd�}dt j f�fd�}dt j f�fd�}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'