fj d Z ddlZddlmZ ddlmZ ddlmZ ddl m
Z
ddlmZm
Z
mZmZ dZd ed
efdZd
edee fd
Zdee
j fd
ededdfdZdS )z4
This module contains X Ray Agent main run function
N)Optional)gettext)Agent) constants)configure_logging
create_socketwrite_sys_idread_sys_idz/var/run/xray-agent.pidpidpidfilec t |d 5 }| t | ddd dS # 1 swxY w Y dS )zB
Save agent process pid to file that other tools can use.
wN)openwritestr)r r fs S/opt/cloudlinux/venv/lib64/python3.11/site-packages/xray/console_utils/run_agent.py _save_pidr s
gs q C s #AAAreturnc ( 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 )Nrr ) r intreadOSErrorIOError
ValueErroroskillProcessLookupError)r r r s r _read_pidr # s
'3
1affhh--C Wj) tt
Q tt JsE A "A A AA AA A'&A'+B
BBsystem_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_sockstart)agentr r! sockets r runr1 4 s
aTUUVVVQi)***}
...4HIIII
")++w//// y+ , , 5
Ft4445 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