config-bash/libs/cgroups.bash

20 lines
350 B
Bash
Raw Normal View History

2013-04-24 16:58:31 +02:00
#!/bin/bash
# Use cgroups
if [ "$PS1" ] ; then
2014-07-03 16:20:20 +02:00
2013-04-24 16:58:31 +02:00
if [ -d /sys/fs/cgroup ] ; then
cdir=/sys/fs/cgroup
elif [ -d /dev/cgroup ]; then
cdir=/dev/cgroup
fi
2014-07-03 16:20:20 +02:00
2014-07-03 17:17:40 +02:00
if [ -n "$cdir/user" ]; then
2013-04-24 16:58:31 +02:00
mkdir -p -m 0700 $cdir/user/$$ > /dev/null 2>&1
/bin/echo $$ > $cdir/user/$$/tasks
/bin/echo '1' > $cdir/user/$$/notify_on_release
unset -v cdir
fi
2014-07-03 16:20:20 +02:00
2013-04-24 16:58:31 +02:00
fi