403Webshell
Server IP : 198.38.94.13  /  Your IP : 216.73.217.33
Web Server : Apache
System : Linux d4744.dxb1.stableserver.net 5.14.0-611.49.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Apr 21 16:39:08 EDT 2026 x86_64
User : revivere ( 1140)
PHP Version : 8.2.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/saltstack/salt/lib/python3.10/site-packages/salt/states/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/saltstack/salt/lib/python3.10/site-packages/salt/states/process.py
"""
Process Management
==================

Ensure a process matching a given pattern is absent.

.. code-block:: yaml

    httpd-absent:
      process.absent:
        - name: apache2
"""


def __virtual__():
    if "ps.pkill" in __salt__:
        return True
    return (False, "ps module could not be loaded")


def absent(name, user=None, signal=None):
    """
    Ensures that the named command is not running.

    name
        The pattern to match.

    user
        The user to which the process belongs

    signal
        Signal to send to the process(es).
    """
    ret = {"name": name, "changes": {}, "result": False, "comment": ""}

    if __opts__["test"]:
        running = __salt__["ps.pgrep"](name, user=user)
        ret["result"] = None
        if running:
            ret["comment"] = f"{len(running)} processes will be killed"
        else:
            ret["comment"] = "No matching processes running"
        return ret

    if signal:
        status = __salt__["ps.pkill"](name, user=user, signal=signal, full=True)
    else:
        status = __salt__["ps.pkill"](name, user=user, full=True)

    ret["result"] = True
    if status:
        ret["comment"] = "Killed {} processes".format(len(status["killed"]))
        ret["changes"] = status
    else:
        ret["comment"] = "No matching processes running"
    return ret

Youez - 2016 - github.com/yon3zu
LinuXploit