Skip to content
This repository has been archived by the owner on Aug 26, 2019. It is now read-only.

Handbook: Processes

Naja Melan edited this page May 2, 2014 · 3 revisions

Get the list of processes on a box:

box.processes

This returns a ProcessSet which behaves like an array, but also lets you do bulk actions (like "kill") on the entire set.

In the shell, "processes" by itself is a shortcut to Rush::Box.new.processes.

Processes have fields uid, pid, command, cmdline, mem, and cpu. Use filter to reduce the set to the entries you want:

box.processes.filter(:pid => ::Process.pid)
box.processes.filter(:cmdline => /ssh/)

ProcessSet acts like an array, so get more complex with a standard select:

box.processes.select { |p| p.cmdline.match(/mongrel_rails/) and p.mem > 100_000 }

Check if the process is alive, or kill it:

ff = box.processes.filter(:cmdline => /firefox/) 
puts ff.alive?.inspect 
ff.kill

Previous: Permissions - Next: bash

source: https://web.archive.org/web/http://rush.heroku.com/handbook/processes

Clone this wiki locally