Skip to content

Instantly share code, notes, and snippets.

@lodestone
Last active August 29, 2015 14:17
Show Gist options
  • Save lodestone/aac16814a31e05d16871 to your computer and use it in GitHub Desktop.
Save lodestone/aac16814a31e05d16871 to your computer and use it in GitHub Desktop.
Renice a process by name on a Mac
#!/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