diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2010-01-06 08:45:11 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2010-01-06 08:45:11 +0000 |
commit | 73281af4d137533d84ab57a40a548a5f0fb56bb9 (patch) | |
tree | 55c36b96a393de7070a42aff9956eebe103488f1 /main/util-vserver/util-vserver.post-install | |
parent | 975f1475c36b7994ec614ab09b083c4f91d2720d (diff) | |
download | aports-73281af4d137533d84ab57a40a548a5f0fb56bb9.tar.bz2 aports-73281af4d137533d84ab57a40a548a5f0fb56bb9.tar.xz |
main/*-vserver: move from testing
good enough for main now
Diffstat (limited to 'main/util-vserver/util-vserver.post-install')
-rw-r--r-- | main/util-vserver/util-vserver.post-install | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/main/util-vserver/util-vserver.post-install b/main/util-vserver/util-vserver.post-install new file mode 100644 index 000000000..9c8aad1e4 --- /dev/null +++ b/main/util-vserver/util-vserver.post-install @@ -0,0 +1,15 @@ +#!/bin/sh + +if [ -f /etc/vservers/.defaults/rlimits/nproc ]; then + exit 0 +fi + +# calculate the nproc limit from amount of ram +memtotal=$(awk '$1 == "MemTotal:" {print $2}' /proc/meminfo 2>/dev/null) +nproc=$(( ${memtotal:-524288} / 256 )) + +# set a "sane" default nproc limit +echo "Setting default nproc limit to $nproc" +mkdir -p /etc/vservers/.defaults/rlimits +echo $nproc > /etc/vservers/.defaults/rlimits/nproc + |