Fli
08-21-2014, 06:14 PM
Linux has software nice and ionice.
/bin/nice (or /usr/bin/nice)
/usr/bin/ionice
these can be used to run some script or command / process with lower or higher priority regarding CPU and Disk I/O.
It means that other processes will have higher priority and our script will cause less negative impact on server performance (will run longer time probably).
NICE
(man nice)
Example use (give script lowest priority):
A) /bin/nice -n 19 /path/to/script.sh
B) nice -n 19 /path/to/script.sh
-n (range from -20 to 19, default is 10)
-n 19 is lowest priority
-n -20 highest process priority
IONICE
(man ionice)
Example use (give script lowest disk priority):
A) /usr/bin/ionice -c2 -n7 /path/to/script.sh
B) ionice -c2 -n7 /path/to/script.sh
-n value is 0 - 7 (0 - highest priority, 7 lowest priority)
-c2 is best effort priority, -c1 is realtime highest process priority
NOTE: ionice may not work on OpenVZ VPS (virtual private servers)
NICE & IONICE
/bin/nice -n 19 /usr/bin/ionice -c2 -n7 /path/to/script.sh
(runs the script.sh with lowest priority)
/bin/nice (or /usr/bin/nice)
/usr/bin/ionice
these can be used to run some script or command / process with lower or higher priority regarding CPU and Disk I/O.
It means that other processes will have higher priority and our script will cause less negative impact on server performance (will run longer time probably).
NICE
(man nice)
Example use (give script lowest priority):
A) /bin/nice -n 19 /path/to/script.sh
B) nice -n 19 /path/to/script.sh
-n (range from -20 to 19, default is 10)
-n 19 is lowest priority
-n -20 highest process priority
IONICE
(man ionice)
Example use (give script lowest disk priority):
A) /usr/bin/ionice -c2 -n7 /path/to/script.sh
B) ionice -c2 -n7 /path/to/script.sh
-n value is 0 - 7 (0 - highest priority, 7 lowest priority)
-c2 is best effort priority, -c1 is realtime highest process priority
NOTE: ionice may not work on OpenVZ VPS (virtual private servers)
NICE & IONICE
/bin/nice -n 19 /usr/bin/ionice -c2 -n7 /path/to/script.sh
(runs the script.sh with lowest priority)