pkill을 사용할 때 stdout 및 stderr 메시지를 억제하는 방법

pkill을 사용할 때 stdout 및 stderr 메시지를 억제하는 방법

명령을 ubuntu 18.04사용하는 일부 프로세스를 종료하려고 합니다 . pkill하지만 Killed어떤 이유에서인지 메시지를 표시하지 않을 수 있습니다.
실행중인 프로세스입니다.

# ps -a
    PID TTY          TIME CMD
   2346 pts/0    00:00:00 gunicorn
   2353 pts/0    00:00:00 sh
   2360 pts/0    00:00:00 gunicorn
   2363 pts/0    00:00:00 gunicorn
   2366 pts/0    00:00:00 ps

프로세스를 종료하고 로그를 억제하려고 시도했습니다.

# 1st attempt
# pkill -9 gunicorn 2>&1 /dev/null
pkill: only one pattern can be provided
Try `pkill --help' for more information.

#2nd attempt (This killed process but got output `Killed` and have to press `enter` to get into command line)
# pkill -9 gunicorn > /dev/null
root@my-ubuntu:/# Killed

#3rd attempt(behavior similar to previous attempt)
# pkill -9 gunicorn 2> /dev/null
root@my-ubuntu:/# Killed

root@my-ubuntu:/#

내가 무엇을 놓치고 있나요?

답변1

아- 살해작전의 결과물이 아니라, 살해당한 물건의 결과물이 아닐까 의심됩니다. 따라서 프로세스에서 stderr을 성공적으로 덤프할 수 있습니다. 또는 stdout에서 KILLED 행을 grep해야 할 수도 있습니다. 별로 예쁘지 않죠?

관련 정보