0

I want to set highest I/O priority using ionice for processes with specific name (farmer and harvest) Please help check what is wrong with my script it's not working

sudo ionice -c 1 -n 0 -p $(ps -ef | grep farmer | awk '{print $2}')
sudo ionice -c 1 -n 0 -p $(ps -ef | grep harvest | awk '{print $2}')

I got the error "ionice: ioprio_set failed: No such process" even though these processes exist

1 Answers1

0

Use pgrep.

sudo ionice -c 1 -n 0 -p $(pgrep farmer)
sudo ionice -c 1 -n 0 -p $(pgrep harvest)
dan
  • 4,846
  • 6
  • 15