403Webshell
Server IP : 3.96.16.70  /  Your IP : 216.73.216.15
Web Server : Apache
System : Linux ip-172-31-26-103.ca-central-1.compute.internal 6.1.163-186.299.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Feb 24 16:35:42 UTC 2026 x86_64
User : ec2-user ( 1000)
PHP Version : 8.4.18
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /usr/lib/python3.9/site-packages/daemon/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3.9/site-packages/daemon/__pycache__/runner.cpython-39.opt-1.pyc
a

{�1`�)�@s
dZddlmZmZddlZddlZddlZddlZddlZddl	Z	ddl
mZddlm
Z
mZmZmZzeWney�eZYn0eZe�de�Gdd	�d	e�ZGd
d�dee�ZGdd
�d
ee�ZGdd�dee�ZGdd�d�Zddd�Z dd�Z!dd�Z"dS)z Daemon runner library.
    �)�absolute_import�unicode_literalsN���pidfile)�0_chain_exception_from_existing_exception_context�
DaemonContext�
basestring�unicodeu@The ‘runner’ module is not a supported API for this library.cs(eZdZdZ�fdd�Zdd�Z�ZS)�DaemonRunnerErrorz3 Abstract base class for errors from DaemonRunner. cs|��t�j|i|��dS)N)�_chain_from_context�super�__init__)�self�args�kwargs��	__class__��1/usr/lib/python3.9/site-packages/daemon/runner.pyr2szDaemonRunnerError.__init__cCst|dd�dS)NT�Zas_cause�r�rrrrr7sz%DaemonRunnerError._chain_from_context)�__name__�
__module__�__qualname__�__doc__rr�
__classcell__rrrrr/src@seZdZdZdd�ZdS)�DaemonRunnerInvalidActionErrorz; Raised when specified action for DaemonRunner is invalid. cCst|dd�dS)NFrrrrrrr>sz2DaemonRunnerInvalidActionError._chain_from_contextN)rrrrrrrrrr;src@seZdZdZdS)�DaemonRunnerStartFailureErrorz, Raised when failure starting DaemonRunner. N�rrrrrrrrrCsrc@seZdZdZdS)�DaemonRunnerStopFailureErrorz, Raised when failure stopping DaemonRunner. Nr rrrrr!Gsr!c@sreZdZdZdZdd�Zdd�Zdd�Zdd
d�Zdd
�Z	dd�Z
dd�Zdd�Ze	eed�Z
dd�Zdd�Zd	S)�DaemonRunnera4 Controller for a callable running in a separate background process.

        The first command-line argument is the action to take:

        * 'start': Become a daemon and call `app.run()`.
        * 'stop': Exit the daemon process specified in the PID file.
        * 'restart': Stop, then start.

        zstarted with pid {pid:d}cCsN|��||_t�|_|�|�d|_|jdur@t|j|j�|_|j|j_dS)a# Set up the parameters of a new runner.

            :param app: The application instance; see below.
            :return: ``None``.

            The `app` argument must have the following attributes:

            * `stdin_path`, `stdout_path`, `stderr_path`: Filesystem paths
              to open and replace the existing `sys.stdin`, `sys.stdout`,
              `sys.stderr`.

            * `pidfile_path`: Absolute filesystem path to a file that will
              be used as the PID file for the daemon. If ``None``, no PID
              file will be used.

            * `pidfile_timeout`: Used as the default acquisition timeout
              value supplied to the runner's PID lock file.

            * `run`: Callable that will be invoked when the daemon is
              started.

            N)	�
parse_args�appr�daemon_context�#_open_streams_from_app_stream_pathsrZpidfile_path�make_pidlockfileZpidfile_timeout�rr$rrrrXs

�zDaemonRunner.__init__cCs8t|jd�|j_t|jd�|j_t|jddd�|j_dS)ab Open the `daemon_context` streams from the paths specified.

            :param app: The application instance.

            Open the `daemon_context` standard streams (`stdin`,
            `stdout`, `stderr`) as stream objects of the appropriate
            types, from each of the corresponding filesystem paths
            from the `app`.
            Zrtzw+tr)�	bufferingN)�openZ
stdin_pathr%�stdinZstdout_path�stdoutZstderr_path�stderrr(rrrr&zs

�z0DaemonRunner._open_streams_from_app_stream_pathscCsHtj�|d�}d}d�|j���}dj||d�}t|�t�	|�dS)z� Emit a usage message, then exit.

            :param argv: The command-line arguments used to invoke the
                program, as a sequence of strings.
            :return: ``None``.

            r��|zusage: {progname} {usage})�prognameZusageN)
�os�path�basename�join�action_funcs�keys�format�emit_message�sys�exit)r�argvr0Zusage_exit_codeZaction_usage�messagerrr�_usage_exit�s�zDaemonRunner._usage_exitNcCsP|durtj}d}t|�|kr(|�|�t|d�|_|j|jvrL|�|�dS)a� Parse command-line arguments.

            :param argv: The command-line arguments used to invoke the
                program, as a sequence of strings.

            :return: ``None``.

            The parser expects the first argument as the program name, the
            second argument as the action to perform.

            If the parser fails to parse the arguments, emit a usage
            message and exit the program.

            Nr.r)r9r;�lenr=r
�actionr5)rr;Zmin_argsrrrr#�s
zDaemonRunner.parse_argscCszt|j�r|j��z|j��Wn*tjyLtdj|jd��}|�Yn0t	�
�}|jj|d�}t|�|j
��dS)z� Open the daemon context and run the application.

            :return: ``None``.
            :raises DaemonRunnerStartFailureError: If the PID file cannot
                be locked by this process.

            z(PID file {pidfile.path!r} already lockedr)�pidN)�is_pidfile_staler�
break_lockr%r*�lockfileZ
AlreadyLockedrr7r1�getpid�
start_messager8r$�run)r�errorr@r<rrr�_start�s

��
zDaemonRunner._startc
Cs\|j��}zt�|tj�Wn:tyV}z"tdj||d��}|�WYd}~n
d}~00dS)z� Terminate the daemon process specified in the current PID file.

            :return: ``None``.
            :raises DaemonRunnerStopFailureError: If terminating the daemon
                fails with an OS error.

            z"Failed to terminate {pid:d}: {exc})r@�excN)	r�read_pidr1�kill�signal�SIGTERM�OSErrorr!r7)rr@rIrGrrr�_terminate_daemon_process�s
��z&DaemonRunner._terminate_daemon_processcCsB|j��s tdj|jd��}|�t|j�r6|j��n|��dS)z� Exit the daemon process specified in the current PID file.

            :return: ``None``.
            :raises DaemonRunnerStopFailureError: If the PID file is not
                already locked.

            z$PID file {pidfile.path!r} not lockedrN)rZ	is_lockedr!r7rArBrO)rrGrrr�_stop�s
��
zDaemonRunner._stopcCs|��|��dS)z Stop, then start.
            N)rPrHrrrr�_restart�szDaemonRunner._restart)�start�stopZrestartcCs>z|j|j}Wn(ty8tdj|jd��}|�Yn0|S)ae Get the function for the specified action.

            :return: The function object corresponding to the specified
                action.
            :raises DaemonRunnerInvalidActionError: if the action is
               unknown.

            The action is specified by the `action` attribute, which is set
            during `parse_args`.

            zUnknown action: {action!r})r?)r5r?�KeyErrorrr7)r�funcrGrrr�_get_action_func�s��
zDaemonRunner._get_action_funccCs|��}||�dS)z� Perform the requested action.

            :return: ``None``.

            The action is specified by the `action` attribute, which is set
            during `parse_args`.

            N)rV)rrUrrr�	do_actions	zDaemonRunner.do_action)N)rrrrrErr&r=r#rHrOrPrQr5rVrWrrrrr"Ks 
"
�r"cCs,|durtj}|�dj|d��|��dS)z@ Emit a message to the specified stream (default `sys.stderr`). Nz
{message}
)r<)r9r-�writer7�flush)r<�streamrrrr8sr8cCsNt|t�stdj|d��}|�tj�|�s>tdj|d��}|�t�||�}|S)z= Make a PIDLockFile instance with the given filesystem path. zNot a filesystem path: {path!r})r2zNot an absolute path: {path!r})	�
isinstancer	�
ValueErrorr7r1r2�isabsrZTimeoutPIDLockFile)r2Zacquire_timeoutrGrCrrrr'&s
��r'c
Cstd}|��}|durpzt�|tj�WnHty<d}Yn4tyn}z|jtjkrZd}WYd}~n
d}~00|S)u� Determine whether a PID file is stale.

        :return: ``True`` iff the PID file is stale; otherwise ``False``.

        The PID file is “stale” if its contents are valid but do not
        match the PID of a currently-running process.

        FNT)	rJr1rKrL�SIG_DFL�ProcessLookupErrorrN�errnoZESRCH)r�resultZpidfile_pidrIrrrrA5s	rA)N)#rZ
__future__rrr`r1rLr9�warningsrC�rZdaemonrrr	r
r_�	NameError�NotImplemented�typeZ
__metaclass__�warn�DeprecationWarning�	Exceptionrr\r�RuntimeErrorrr!r"r8r'rArrrr�<module>
s6
�T


Youez - 2016 - github.com/yon3zu
LinuXploit