aboutsummaryrefslogtreecommitdiffstats
path: root/testing/util-vserver/util-vserver.post-install
blob: 9c8aad1e4c899963a80dbab480af373ef6397525 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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