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する必要があるかもしれません。あまりきれいではありませんか?

おすすめ記事