go-limit

command module
v0.0.0-...-61bbba6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 18, 2016 License: MIT Imports: 8 Imported by: 0

README

go-limit

Simple tool to run command with limited resource. Only works on linux for now.

Install

Your need libcgroup to compile go-cgroup. Install it with your package manager:

On debian:

sudo apt-get install -y libcgroup-dev

On fedora:

sudo yum install -y libcgroup-devel

Install this project:

go get github.com/inoc603/go-limit

Usage

Make sure you have root privilege and $GOPATH/bin is in your PATH

go-limit --cpu CPU_USAGE_PERCENTAGE --memory MEMORY_LIMIT YOUR_COMMAND

CPU_USAGE_PERCENTAGE is an interger between 1 and 100

MEMORY_LIMIT is the memory limit in bytes, the following formats are allowed:

  • 512
  • 128k 128k
  • 128m 128M
  • 128g 128G

Example

# limit cpu usage to 50%
go-limit --cpu 50 example/cpu.py
# limit memory usage to 512MB
go-limit --memory 512M example/mem.py

TODO

  • Handle keyboard interruption signal

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL