Class: ProconBypassMan::ReniceCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/procon_bypass_man/support/renice_command.rb

Class Method Summary collapse

Class Method Details

.change_priority(to:, pid:) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/procon_bypass_man/support/renice_command.rb', line 3

def self.change_priority(to: , pid: )
  cmd =
    case to
    when :high
      "renice -n -20 -p #{pid}"
    when :low
      "renice -n 20 -p #{pid}"
    else
      raise "unknown priority"
    end
  ProconBypassMan.logger.debug { "[SHELL] #{cmd}" }
  `sudo #{cmd}`
end