Skip to content

Instantly share code, notes, and snippets.

@koron

koron/wrap-limit-v

Last active Jan 18, 2020
Embed
What would you like to do?
apply cgroup memory limitation as `ulimit -v` virtual memory limitation
#!/bin/sh
set -eu
cgroup_rsslimit="/sys/fs/cgroup/memory/memory.limit_in_bytes"
if [ -r "$cgroup_rsslimit" ] ; then
rsslimit=`cat "$cgroup_rsslimit"`
vszlimit=`expr $rsslimit / 1024`
ulimit -v $vszlimit
fi
exec "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.