Last active
August 29, 2015 14:17
-
-
Save lodestone/aac16814a31e05d16871 to your computer and use it in GitHub Desktop.
Renice a process by name on a Mac
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
begin | |
if ARGV.length == 1 | |
%x[sudo renice -10 `pgrep -f -i #{ARGV[0]}`] | |
else | |
%x[sudo renice #{ARGV[0]} `pgrep -f -i #{ARGV[1]}`] | |
end | |
rescue | |
puts "There was an error, try: renice-by-name <(-10..10)> process_name" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment