public
Description: personal scripts
Homepage:
Clone URL: git://github.com/mackstann/bin.git
bin / TakeItEasy
100755 30 lines (22 sloc) 0.558 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/sh
 
# Written by Nick Welch <nick@incise.org>. Author disclaims copyright.
 
# TakeItEasy: re-prioritize existing process(es) to the lowest cpu and i/o
# priorities.
 
# see also: DoItEasy
 
# pass in one or more arguments, each being either a numerical pid or the name
# of a process
 
is_numeric () { echo $1 | egrep -q '^[0-9]+$'; }
 
for arg in $*
do
if is_numeric "$arg"
    then
pids=$arg
    else
pids=`pidof $arg`
    fi
for pid in $pids
    do
sudo ionice -c3 -p $pid
        sudo renice 20 -p $pid
    done
done