Posted on 2011-02-26
I am trying to write a bash script that will run every 30 minutes in cron that will search for all process`s owned by user bob and renice them to the value of 10.
I seem to have the logic of the script but I am unable to glue things together.
1. Firstly we need to obviously get the process`s owned by user bob - so something like ps aux | grep bob - this will gives us all the process owned by bob
2. We then need to return the process id for every process owned by bob and set the niceness to 10. So am thinking we need to use something like the cut command to return the pid column
3. We will probably need a loop to iterate through every process id and set the nicessness to 10 using the "renice -n 10 PID"
I have the logic but am unable to put it together. Any help would be really appreciated.