MCPcopy Create free account
hub / github.com/saltstack/salt / run_bg

Function run_bg

salt/modules/cmdmod.py:4824–5075  ·  view source on GitHub ↗

r""" .. versionadded:: 2016.3.0 Execute the passed command in the background and return its PID .. note:: If the init system is systemd and the backgrounded task should run even if the salt-minion process is restarted, prepend ``systemd-run --scope`` to the com

(
    cmd,
    cwd=None,
    runas=None,
    group=None,
    shell=DEFAULT_SHELL,
    python_shell=None,
    env=None,
    clean_env=False,
    template=None,
    umask=None,
    timeout=None,
    output_encoding=None,
    output_loglevel="debug",
    log_callback=None,
    reset_system_locale=True,
    ignore_retcode=False,
    saltenv=None,
    password=None,
    prepend_path=None,
    success_retcodes=None,
    success_stdout=None,
    success_stderr=None,
    **kwargs,
)

Source from the content-addressed store, hash-verified

4822
4823
4824def run_bg(
4825 cmd,
4826 cwd=None,
4827 runas=None,
4828 group=None,
4829 shell=DEFAULT_SHELL,
4830 python_shell=None,
4831 env=None,
4832 clean_env=False,
4833 template=None,
4834 umask=None,
4835 timeout=None,
4836 output_encoding=None,
4837 output_loglevel="debug",
4838 log_callback=None,
4839 reset_system_locale=True,
4840 ignore_retcode=False,
4841 saltenv=None,
4842 password=None,
4843 prepend_path=None,
4844 success_retcodes=None,
4845 success_stdout=None,
4846 success_stderr=None,
4847 **kwargs,
4848):
4849 r"""
4850 .. versionadded:: 2016.3.0
4851
4852 Execute the passed command in the background and return its PID
4853
4854 .. note::
4855
4856 If the init system is systemd and the backgrounded task should run even
4857 if the salt-minion process is restarted, prepend ``systemd-run
4858 --scope`` to the command. This will reparent the process in its own
4859 scope separate from salt-minion, and will not be affected by restarting
4860 the minion service.
4861
4862 :param str cmd: The command to run. ex: ``ls -lart /home``
4863
4864 :param str cwd: The directory from which to execute the command. Defaults
4865 to the home directory of the user specified by ``runas`` (or the user
4866 under which Salt is running if ``runas`` is not specified).
4867
4868 :param str group: Group to run command as. Not currently supported
4869 on Windows.
4870
4871 :param str shell: Shell to execute under. Defaults to the system default
4872 shell.
4873
4874 :param str output_encoding: Control the encoding used to decode the
4875 command's output.
4876
4877 .. note::
4878 This should not need to be used in most cases. By default, Salt
4879 will try to use the encoding detected from the system locale, and
4880 will fall back to UTF-8 if this fails. This should only need to be
4881 used in cases where the output of the command is encoded in

Callers

nothing calls this directly

Calls 3

_python_shell_defaultFunction · 0.85
_runFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected