1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
#!/bin/bash
# Courtesy of https://github.com/sosy-lab/benchexec
echo ------------------------
echo "Existing mount points:"
mount
echo ------------------------
echo "Existing users:"
getent passwd
echo ------------------------
PRIMARY_USER="$1"
# Set up cgroups
for i in blkio cpuacct cpuset freezer memory cpu pids; do
if [ ! -d "/sys/fs/cgroup/$i" ]; then
mkdir /sys/fs/cgroup/$i
mount cgroup-$i /sys/fs/cgroup/$i -t cgroup -o $i
fi
chgrp "$(id -g "$PRIMARY_USER")" /sys/fs/cgroup/$i
chmod g+rwx /sys/fs/cgroup/$i
done
echo ------------------------
echo "Now mount points:"
mount
ls -liah /sys/fs/cgroup/
|