관리-도구
편집 파일: run_agent.cpython-311.pyc
� b��f� � � � d Z ddlZddlmZ ddlmZ ddlmZ ddl m Z ddlmZm Z mZmZ dZd ed efd�Zd edee fd �Zdee j fd ededdfd�ZdS )z4 This module contains X Ray Agent main run function � N)�Optional)�gettext)�Agent)� constants)�configure_logging� create_socket�write_sys_id�read_sys_idz/var/run/xray-agent.pid�pid�pidfilec � � t |d� � 5 }|� t | � � � � ddd� � dS # 1 swxY w Y dS )zB Save agent process pid to file that other tools can use. �wN)�open�write�str)r r �fs �S/opt/cloudlinux/venv/lib64/python3.11/site-packages/xray/console_utils/run_agent.py� _save_pidr s� � � �g�s� � � �q� ����C������� � � � � � � � � � � ���� � � � � � s �#A�A�A�returnc �( � t | d� � 5 }t |� � � � � }d d d � � n# 1 swxY w Y n# t t t f$ r Y d S w xY w t j |d� � n# t $ r Y d S w xY w|S )N�rr ) r �int�read�OSError�IOError� ValueError�os�kill�ProcessLookupError)r r r s r � _read_pidr # s� � �� �'�3� � � �1��a�f�f�h�h�-�-�C� � � � � � � � � � � ���� � � � ����W�j�)� � � ��t�t����� � ���Q������� � � ��t�t����� �JsE �A �"A �A � A�A �A�A �A'�&A'�+B � B�B�system_id_cache_filec �� � t |� � r+t t d� � � � t d� � t t j � � | �t t � � �� � } t | j |�� � t t j � � |�� � t t j � � 5 }| � |d�� � ddd� � dS # 1 swxY w Y dS ) z Main run function zBAnother daemon instance is already running, please, stop it first.� N)� system_id)�agent_system_id_path)r r T)�background_routine)r �print�_�exitr r � agent_logr r r �sys_idr r �getpidr � agent_sock�start)�agentr r! �sockets r �runr1 4 s � � ���� � �a�T�U�U�V�V�V��Q�����i�)�*�*�*��}��� � �.�.�.�����4H�I�I�I�I� �"�)�+�+�w�/�/�/�/� �y�+� ,� ,� 5�� ���F�t��4�4�4�5� 5� 5� 5� 5� 5� 5� 5� 5� 5� 5� 5���� 5� 5� 5� 5� 5� 5s �C(�(C,�/C,)�__doc__r �typingr �xrayr r( �xray.agent.daemonr � xray.internalr �xray.internal.utilsr r r r �PIDFILEr r r r � agent_filer1 � � r �<module>r<