mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2026-01-14 05:02:28 +01:00
16 lines
411 B
Bash
16 lines
411 B
Bash
#!/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
|
|
|