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)
| 207 | |
| 208 | |
| 209 | def 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 | |
| 239 | def pkill(pattern, user=None, signal=15, full=False): |
nothing calls this directly
no test coverage detected