CasperSecurity

Current Path : /lib/python3/dist-packages/supervisor/__pycache__/
Upload File :
Current File : //lib/python3/dist-packages/supervisor/__pycache__/supervisord.cpython-310.pyc

o

�X[_�8�@s�dZddlZddlZddlZddlmZddlmZddl	m
Z
ddl	mZddl	mZddl
mZdd	lmZdd
lmZGdd�d�Zd
d�Zdd�Zddd�Zdd�Zedkr_e�dSdS)a�supervisord -- run a set of applications as daemons.

Usage: %s [options]

Options:
-c/--configuration FILENAME -- configuration file path (searches if not given)
-n/--nodaemon -- run in the foreground (same as 'nodaemon=true' in config file)
-s/--silent -- no logs to stdout (maps to 'silent=true' in config file)
-h/--help -- print this usage message and exit
-v/--version -- print supervisord version number and exit
-u/--user USER -- run supervisord as this user (or numeric uid)
-m/--umask UMASK -- use this umask for daemon subprocess (default is 022)
-d/--directory DIRECTORY -- directory to chdir to when daemonized
-l/--logfile FILENAME -- use FILENAME as logfile path
-y/--logfile_maxbytes BYTES -- use BYTES to limit the max size of logfile
-z/--logfile_backups NUM -- number of backups to keep when max bytes reached
-e/--loglevel LEVEL -- use LEVEL as log level (debug,info,warn,error,critical)
-j/--pidfile FILENAME -- write a pid file for the daemon process to FILENAME
-i/--identifier STR -- identifier used for this instance of supervisord
-q/--childlogdir DIRECTORY -- the log directory for child process logs
-k/--nocleanup --  prevent the process from performing cleanup (removal of
                   old automatic child log files) at startup.
-a/--minfds NUM -- the minimum number of file descriptors for start success
-t/--strip_ansi -- strip ansi escape codes from process output
--minprocs NUM  -- the minimum number of processes available for start success
--profile_options OPTIONS -- run supervisord under profiler and output
                             results based on OPTIONS, which  is a comma-sep'd
                             list of 'cumulative', 'calls', and/or 'callers',
                             e.g. 'cumulative,callers')
�N)�asyncore_25)�	as_string)�
ServerOptions)�decode_wait_status)�signame)�events)�SupervisorStates)�getProcessStateDescriptionc@s�eZdZdZdZdZdZdd�Zdd�Zdd	�Z	d"d
d�Z
dd
�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd"dd�Zd#dd�Zdd�Zd d!�ZdS)$�
SupervisorFrNcCs||_i|_i|_dS�N)�options�process_groups�ticks)�selfr�r�8/usr/lib/python3/dist-packages/supervisor/supervisord.py�__init__6s
zSupervisor.__init__cCsV|jjs	|j��|j��|jjr|j��|j��|jjs%|j��|��dSr)	r�first�cleanup_fds�set_uid_or_exit�set_rlimits_or_exit�make_logger�	nocleanup�clear_autochildlogdir�run�rrrr�main;s




zSupervisor.maincCs�i|_d|_t��z:|jjD]}|�|�q|j��|j�|�|j�	�|jj
s4|jjr4|j��|j�
�|��W|j��dS|j��wr)r
�stop_groupsr�clearr�process_group_configs�add_process_group�process_environment�openhttpservers�
setsignals�nodaemonr�	daemonize�
write_pidfile�
runforever�cleanup)r�configrrrrPs




zSupervisor.runcs�|s|jj}dd�|j��D�}ttdd�|D�|���ttdd�|D�|����fdd�|D�}�fdd�|D�}�fdd�|D�}|||fS)NcS�g|]}|j�qSr)r))�.0�grouprrr�
<listcomp>f�z-Supervisor.diff_to_active.<locals>.<listcomp>cSr*r��name�r+�cfgrrrr-hr.cSr*rr/r1rrrr-ir.c�g|]	}|j�vr|�qSrr/�r+�cand��curdictrrr-k�cr3rr/r4)�newdictrrr-lr8cs"g|]
}|��|j|�kr|�qSr)�getr0r4r6rrr-ns�)rrr
�values�dict�zip)r�new�cur�added�removed�changedr)r7r9r�diff_to_activecs
zSupervisor.diff_to_activecCs>|j}||jvr|��|��|j|<t�t�|��dSdS)NTF)r0r
�after_setuid�
make_groupr�notify�ProcessGroupAddedEvent)rr)r0rrrr ss
zSupervisor.add_process_groupcCs<|j|��r	dS|j|��|j|=t�t�|��dS)NFT)r
�get_unstopped_processes�
before_removerrF�ProcessGroupRemovedEvent)rr0rrr�remove_process_group|szSupervisor.remove_process_groupcCs&i}|j��D]	}|�|���q|Sr)r
r;�update�get_dispatchers)r�process_mapr,rrr�get_process_map�szSupervisor.get_process_mapcCs�g}|j��D]	}|�|���q|rNt��}||jdkrNdd�|D�}d�|�}|jj�	d|�||_|D]}t
|���}|jj�d|j
j|f�q8|S)N�cSsg|]}t|jj��qSr)rr)r0)r+�prrrr-�sz.Supervisor.shutdown_report.<locals>.<listcomp>z, zwaiting for %s to diez%s state: %s)r
r;�extendrH�time�lastshutdownreport�joinr�logger�infor	�	get_state�blatherr)r0)r�	unstoppedr,�now�names�namestr�proc�staterrr�shutdown_report�s 
�zSupervisor.shutdown_reportcCs|jr|jd��dSdS)N���)r�stop_allrrrr�ordered_stop_groups_phase_1�s�z&Supervisor.ordered_stop_groups_phase_1cCs0|jr|j��}|��r|j�|�dSdSdSr)r�poprH�append)rr,rrr�ordered_stop_groups_phase_2�s
�z&Supervisor.ordered_stop_groups_phase_2c
	Cs*t�t���d}|j��}	i}|�|�|�|���t|j�	��}|�
�|jjtj
krN|jsCd|_|dd�|_t�t���|��|��sNtj�|��D]\}}|��ra|jj�|�|��rl|jj�|�qR|jj�|�\}}|D]8}||vr�z||}|jjjd|d�|��|��s�|jj�|�Wqxtjy��||� �Yqxqx|D]8}||vr�z||}|jjjd|d�|�!�|��s�|jj�"|�Wq�tjy��||� �Yq�q�|D]}	|	�#�q�|�$�|�%�|�&�|jjtj
k�r
|�'�|jj(�rdSq)N�Tz#read event caused by %(dispatcher)r)�
dispatcherz$write event caused by %(dispatcher)r))rrF�SupervisorRunningEventr�get_socket_maprLrO�listr
r;�sort�moodr�RUNNING�stoppingr�SupervisorStoppingEventrcr`�asyncore�ExitNow�items�readable�poller�register_readable�writable�register_writable�pollrVrY�handle_read_event�unregister_readable�handle_error�handle_write_event�unregister_writable�
transition�reap�
handle_signal�tickrf�test)
r�timeout�
socket_map�combined_map�pgroups�fdrh�r�wr,rrrr'�s�

�������

�zSupervisor.runforevercCsz|durt��}tjD]/}|j}|j�|�}|dur$t||�}|j|<t||�}||kr:||j|<t�|||��qdS)zo Send one or more 'tick' events when the timeslice related to
        the period for the event type rolls over N)rSr�TICK_EVENTS�periodrr:�	timeslicerF)rr[�eventr��	last_tick�	this_tickrrrr�s


��zSupervisor.tickcCs�|dkrdS|j��\}}|rE|jj�|d�}|dur-t|�\}}|jj�d||f�n|�||�|jj|=|sG|jd|dd�dSdSdS)N�dzreaped unknown pid %s (%s)Frg)�once�recursionguard)	r�waitpid�
pidhistoryr:rrVrW�finishr�)rr�r��pid�sts�process�_�msgrrrr�s
�zSupervisor.reapcCs$|j��}|r�|tjtjtjfvr#|jj�dt|��t	j
|j_dS|tjkrN|jjt	j
kr<|jj�dt|��dS|jj�dt|��t	j
|j_dS|tjkr`|jj�dt|��dS|tjkr�|jj�dt|��|j��|j��D]}|��qzdS|jj�dt|��dSdS)Nz#received %s indicating exit requestz<ignored %s indicating restart request (shutdown in progress)z&received %s indicating restart requestz#received %s indicating a child quitz)received %s indicating log reopen requestzreceived %s indicating nothing)r�
get_signal�signal�SIGTERM�SIGINT�SIGQUITrV�warnrr�SHUTDOWNrm�SIGHUP�
RESTARTING�SIGCHLD�debug�SIGUSR2rW�
reopenlogsr
r;rY)r�sigr,rrrr�"s@

�

�
�

�

�

�
��zSupervisor.handle_signalcCs|jjSr)rrmrrrrrX>szSupervisor.get_stater)Fr)�__name__�
__module__�__qualname__rorTr
rrrrrCr rKrOr`rcrfr'r�r�r�rXrrrrr
0s(
	
P
r
cCst|||�Sr)�int)r��whenrrrr�Asr�c	Cs�zddl}Wn
tyddl}Ynwddl}ddl}|��\}}	z5|�||||	�|�|	�}
|
��|
j	|p9d�|rC|
�
d�n
|
�d�Wt�
|	�dSWt�
|	�dSt�
|	�w)Nr)�
cumulative�callsrSg333333�?)�cProfile�ImportError�profile�pstats�tempfile�mkstemp�runctx�Stats�
strip_dirs�
sort_stats�
print_callers�print_stats�os�remove)�cmd�globals�locals�
sort_order�callersr�r�r�r��fn�statsrrrr�Es&�
�r�FcCs�tjdks	Jd��d}	t�}|j|td�||_||_|jr/|j\}}tdt	�t
�||�nt|�|��|�
�d}|sE|jtjkrGdSq)N�posixz)This code makes Unix-specific assumptionsTrg)�doczgo(options)F)r�r0r�realize�__doc__rr��profile_optionsr�r�r��go�close_httpservers�close_loggerrmrr�)�argsr�rrr�r�rrrr\s"
�rcCs.t|�}z|��WdStjyYdSwr)r
rrqrr)r�drrrr�ps�r��__main__)NF)r�r�rSr��supervisor.medusarrq�supervisor.compatr�supervisor.optionsrrr�
supervisorr�supervisor.statesrr	r
r�r�rr�r�rrrr�<module>s,

�
Hacker Blog, Shell İndir, Sql İnjection, XSS Attacks, LFI Attacks, Social Hacking, Exploit Bot, Proxy Tools, Web Shell, PHP Shell, Alfa Shell İndir, Hacking Training Set, DDoS Script, Denial Of Service, Botnet, RFI Attacks, Encryption
Telegram @BIBIL_0DAY