]> git.phdru.name Git - dotfiles.git/blob - bin/cgmem_nice
Rename phd.m4 -> main.m4
[dotfiles.git] / bin / cgmem_nice
1 #! /bin/sh
2
3 usage() {
4    echo "Usage: $0 {100|200|300|500|1000|2000|4000} [command [args]]"
5    exit 1
6 }
7
8 case "$1" in
9    100|200|300|500|1000|2000|4000)
10    ;;
11
12    *) usage
13    ;;
14 esac
15
16 size="$1" # in megabytes
17 shift
18
19 CGROUPS=/sys/fs/cgroup
20 echo $$ > "$CGROUPS"/${size}M/tasks || exit 1
21
22 ulimit -d ${size}000
23 exec nice -20 ionice -c3 "${@:-$SHELL}"