Softly kills your process with SIGTERM before it runs out of memory.
Ruby Rust
Latest commit dbc1e50 Jan 23, 2017 @grosser switch to whilelist include
Permalink
Failed to load latest commit information.
src move to standard location Jan 23, 2017
target/x86_64-apple-darwin/release compile Jan 22, 2017
test fail fast and helpful when files do not exist Jan 23, 2017
.gitignore compile Jan 22, 2017
Cargo.lock done Jan 22, 2017
Cargo.toml switch to whilelist include Jan 23, 2017
Gemfile tests Jan 22, 2017
Gemfile.lock bump Jan 22, 2017
Rakefile update Jan 23, 2017
Readme.md update Jan 23, 2017

Readme.md

Softly kills your process with SIGTERM before it runs out of memory.

  • Made for processes that run inside docker.
  • defaults to /sys/fs/cgroup/memory/memory.usage_in_bytes and /sys/fs/cgroup/memory/memory.stat

Written in Rust to consume minimal resources.

Version: 0.0.1

Usage

Download the binary you need from target/your-arch or cargo install preoomkiller.

Usage: target/debug/preoomkiller [options] args

Options:
    -m, --max-memory-file PATH
                        set file to read maximum memory from
    -u, --used-memory-file PATH
                        set file to read used memory from
    -i, --interval SECONDS
                        how often to check memory usage
    -p, --percent PERCENT
                        maximum memory usage percent
    -h, --help          print this help menu
    -v, --version       show version

Build

Test

Tested with Ruby to have readable / expressive tests.

  • Build
  • gem install bundler ... needs ruby installed
  • bundle
  • bundle exec rake

Release

  • bundle exec rake bump:patch
  • bundle exec rake release

TODO

  • remove regex dependency by splitting string and searching manually
  • travis + show status on crates.io
  • kill child when process is killed (already has a failing test)
  • find safe way of doing wait / kill ... http://stackoverflow.com/questions/35093869
  • make rake bump release for multiple targets and commit all changes
  • add --signal option ... support numbers and ideally USR1 etc words
  • make percent a float
  • add --restart option to not kill but restart ... maybe don't since this is tricky / needs a limit