#!/bin/sh if [ $USER != root ]; then echo "Error: you need to run this script as root." echo "Exiting..." exit 0 fi mkdir /usr/local/sbin >/dev/null 2>&1 cat <<_EOF >/usr/local/sbin/cgroup_clean #!/bin/sh if [ "$*" != "/user" ]; then rmdir /dev/cgroup/cpu/$* fi _EOF chmod u+x /usr/local/sbin/cgroup_clean cat <<_EOF >/etc/event.d/speedpatch description "speedpatch" console none start on MOUNTS_OK stop on stopping xomap script mkdir -p /dev/cgroup/cpu mount -t cgroup cgroup /dev/cgroup/cpu -o cpu,memory mkdir -m 0777 /dev/cgroup/cpu/user echo "/usr/local/sbin/cgroup_clean" > /dev/cgroup/cpu/release_agent echo "1" > /dev/cgroup/cpu/user/notify_on_release end script _EOF if [ `cat /home/user/.profile |grep /dev/cgroup |wc -l` -eq 0 ] ; then cat <<_EOF >>/home/user/.profile if [ "\$PS1" ] ; then mkdir -p -m 0700 /dev/cgroup/cpu/user/\$\$ echo \$\$ > /dev/cgroup/cpu/user/\$\$/tasks echo "1" > /dev/cgroup/cpu/user/\$\$/notify_on_release fi _EOF fi echo Patch complete, reboot to enable