renice
プロセスとシステム
書き方
renice -n <priority> -p <pid>すでに動いているプロセスの優先度を変えます。一般利用者は譲る方向にしか動かせず、下げた分を戻すには root が必要です。
よく使うオプション
| オプション | 意味 |
|---|---|
| -n <value> | The new niceness, from 19 (nicest) to -20 (greediest). |
| -p <pid> | Apply it to a process ID. |
| -u <user> | Apply it to all of a user's processes. |
| -g <pgid> | Apply it to a process group. |
例
renice -n 10 -p 1234Make a running job nicer so it stops hogging the CPU.
sudo renice -n -5 -p $(pgrep -x mysqld)Give the database more priority than everything else.
何が動いていて何が資源を食っているかを見ます。止める前に何なのかを確かめるのが順番です。
読み方
- 角括弧 [ ] は省いてよい部分です。
- 三点 … は複数並べられるという意味です。
- オプションは大文字小文字を区別します — -r と -R が別物のコマンドもあります。
よくある質問
Q. renice は何をしますか。
すでに動いているプロセスの優先度を変えます。一般利用者は譲る方向にしか動かせず、下げた分を戻すには root が必要です。
Q. どう打ちますか。
renice -n <priority> -p <pid> — 角括弧は省いてよい部分です。
Q. よく使うオプションはいくつですか。
ここにまとめたのは4個です。全部は man renice にあります。このコマンドはプロセスとシステムの仲間です。
関連するコマンド
man ページ: man renice