MCPcopy Index your code
hub / github.com/saltstack/salt / kill_pid

Function kill_pid

salt/modules/ps.py:209–236  ·  view source on GitHub ↗

Kill a process by PID. .. code-block:: bash salt 'minion' ps.kill_pid pid [signal=signal_number] pid PID of process to kill. signal Signal to send to the process. See manpage entry for kill for possible values. Default: 15 (SIGTERM). **Exampl

(pid, signal=15)

Source from the content-addressed store, hash-verified

207
208
209def kill_pid(pid, signal=15):
210 """
211 Kill a process by PID.
212
213 .. code-block:: bash
214
215 salt 'minion' ps.kill_pid pid [signal=signal_number]
216
217 pid
218 PID of process to kill.
219
220 signal
221 Signal to send to the process. See manpage entry for kill
222 for possible values. Default: 15 (SIGTERM).
223
224 **Example:**
225
226 Send SIGKILL to process with PID 2000:
227
228 .. code-block:: bash
229
230 salt 'minion' ps.kill_pid 2000 signal=9
231 """
232 try:
233 psutil.Process(pid).send_signal(signal)
234 return True
235 except psutil.NoSuchProcess:
236 return False
237
238
239def pkill(pattern, user=None, signal=15, full=False):

Callers

nothing calls this directly

Calls 2

send_signalMethod · 0.80
ProcessMethod · 0.80

Tested by

no test coverage detected