#NEWLINE# def run_bg( cmd , cwd = None , runas = None , shell = DEFAULT_SHELL , python_shell = None , env = None , clean_env = False , template = None , umask = None , timeout = None , output_loglevel = 'debug' , log_callback = None , reset_system_locale = True , saltenv = 'base' , **kwargs ) : #NEWLINE# #INDENT# '\n    .. versionadded: 2016.3.0\n\n    Execute the passed command in the background and return it\'s PID\n\n    Note that ``env`` represents the environment variables for the command, and\n    should be formatted as a dict, or a YAML string which resolves to a dict.\n\n    :param str cmd: The command to run. ex: \'ls -lart /home\'\n\n    :param str cwd: The current working directory to execute the command in,\n      defaults to `/root` (`C:\\` in windows)\n\n    :param str output_loglevel: Control the loglevel at which the output from\n      the command is logged. Note that the command being run will still be logged\n      (loglevel: DEBUG) regardless, unless ``quiet`` is used for this value.\n\n    :param str runas: User to run script as. If running on a Windows minion you\n      must also pass a password\n\n    :param str shell: Shell to execute under. Defaults to the system default\n      shell.\n\n    :param bool python_shell: If False, let python handle the positional\n      arguments. Set to True to use shell features, such as pipes or redirection\n\n    :param list env: A list of environment variables to be set prior to\n      execution.\n\n        Example:\n\n        .. code-block:: yaml\n\n            salt://scripts/foo.sh:\n              cmd.script:\n                - env:\n                  - BATCH: \'yes\'\n\n        .. warning::\n\n            The above illustrates a common PyYAML pitfall, that **yes**,\n            **no**, **on**, **off**, **true**, and **false** are all loaded as\n            boolean ``True`` and ``False`` values, and must be enclosed in\n            quotes to be used as strings. More info on this (and other) PyYAML\n            idiosyncrasies can be found :doc:`here\n            </topics/troubleshooting/yaml_idiosyncrasies>`.\n\n        Variables as values are not evaluated. So $PATH in the following\n        example is a literal \'$PATH\':\n\n        .. code-block:: yaml\n\n            salt://scripts/bar.sh:\n              cmd.script:\n                - env: "PATH=/some/path:$PATH"\n\n        One can still use the existing $PATH by using a bit of Jinja:\n\n        .. code-block:: yaml\n\n            {% set current_path = salt[\'environ.get\'](\'PATH\', \'/bin:/usr/bin\') %}\n\n            mycommand:\n              cmd.run:\n                - name: ls -l /\n                - env:\n                  - PATH: {{ [current_path, \'/my/special/bin\']|join(\':\') }}\n\n    :param bool clean_env: Attempt to clean out all other shell environment\n      variables and set only those provided in the \'env\' argument to this\n      function.\n\n    :param str template: If this setting is applied then the named templating\n      engine will be used to render the downloaded file. Currently jinja, mako,\n      and wempy are supported\n\n    :param str umask: The umask (in octal) to use when running the command.\n\n    :param int timeout: A timeout in seconds for the executed process to return.\n\n    .. warning::\n\n        This function does not process commands through a shell\n        unless the python_shell flag is set to True. This means that any\n        shell-specific functionality such as \'echo\' or the use of pipes,\n        redirection or &&, should either be migrated to cmd.shell or\n        have the python_shell=True flag set here.\n\n        The use of python_shell=True means that the shell will accept _any_ input\n        including potentially malicious commands such as \'good_command;rm -rf /\'.\n        Be absolutely certain that you have sanitized your input prior to using\n        python_shell=True\n\n    CLI Example:\n\n    .. code-block:: bash\n\n        salt \'*\' cmd.run_bg "fstrim-all"\n\n    The template arg can be set to \'jinja\' or another supported template\n    engine to render the command arguments before execution.\n    For example:\n\n    .. code-block:: bash\n\n        salt \'*\' cmd.run_bg template=jinja "ls -l /tmp/{{grains.id}} | awk \'/foo/{print \\\\$2}\'"\n\n    Specify an alternate shell with the shell parameter:\n\n    .. code-block:: bash\n\n        salt \'*\' cmd.run_bg "Get-ChildItem C:\\\\ " shell=\'powershell\'\n\n    If an equal sign (``=``) appears in an argument to a Salt command it is\n    interpreted as a keyword argument in the format ``key=val``. That\n    processing can be bypassed in order to pass an equal sign through to the\n    remote shell command by manually specifying the kwarg:\n\n    .. code-block:: bash\n\n        salt \'*\' cmd.run_bg cmd=\'ls -lR / | sed -e s/=/:/g > /tmp/dontwait\'\n    ' #NEWLINE# python_shell = _python_shell_default ( python_shell , kwargs . get ( '__pub_jid' , '' ) ) #NEWLINE# res = _run ( cmd , stdin = None , stderr = None , stdout = None , output_loglevel = output_loglevel , use_vt = None , bg = True , with_communicate = False , rstrip = False , runas = runas , shell = shell , python_shell = python_shell , cwd = cwd , env = env , clean_env = clean_env , template = template , umask = umask , log_callback = log_callback , timeout = timeout , reset_system_locale = reset_system_locale , saltenv = saltenv , pillarenv = kwargs . get ( 'pillarenv' ) , pillar_override = kwargs . get ( 'pillar' ) ) #NEWLINE# return { #NEWLINE# #INDENT# 'pid' : res [ 'pid' ] , #NEWLINE# #UNINDENT# }