Published using Google Docs
install_cpulimit_service.sh
Updated automatically every 5 minutes

#!/bin/bash

# Program:

# USE SHELL SCRIPT Install CPU Load Limit ON Linux Server (CentOS).

#install cpulimit and gawk

rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

#Enable epel

sed -i -e 's/enabled=0/enabled=1/g' /etc/yum.repos.d/epel.repo

yum install -y cpulimit gawk

#disable epel

sed -i -e 's/enabled=1/enabled=0/g' /etc/yum.repos.d/epel.repo

#install cpulimit service and daemon

cp cpulimit_daemon.sh /usr/bin

chmod 700 /usr/bin/cpulimit_daemon.sh

cp cpulimit /etc/init.d/

chown root.root /etc/init.d/cpulimit

chmod +x /etc/init.d/cpulimit

chkconfig --add /etc/init.d/cpulimit

exit