41
install_shell/cgroup-d5000-install/.bashrc
Normal file
41
install_shell/cgroup-d5000-install/.bashrc
Normal file
@@ -0,0 +1,41 @@
|
||||
#
|
||||
# ~/.bashrc: user defaults for bash(1) login shells
|
||||
#
|
||||
|
||||
if [ "`id -u`" = "0" ]; then
|
||||
export PATH="/sbin:/usr/sbin:/bin:/usr/bin:/opt/bin"
|
||||
elif [ "`id -un`" = "sysadmin" ]; then
|
||||
export PATH="/sbin:/usr/sbin:/bin:/usr/bin:/opt/bin"
|
||||
elif [ "`id -un`" = "netadmin" ]; then
|
||||
export PATH="/sbin:/usr/sbin:/bin:/usr/bin:/opt/bin"
|
||||
elif [ "`id -un`" = "secadmin" ]; then
|
||||
export PATH="/sbin:/usr/sbin:/bin:/usr/bin:/opt/bin"
|
||||
elif [ "`id -un`" = "audadmin" ]; then
|
||||
export PATH="/sbin:/usr/sbin:/bin:/usr/bin:/opt/bin"
|
||||
else
|
||||
export PATH="/bin:/usr/bin:/opt/bin"
|
||||
fi
|
||||
|
||||
if [ ! -f ~/.inputrc ]; then
|
||||
export INPUTRC="/etc/inputrc"
|
||||
fi
|
||||
|
||||
export MANPATH="/usr/man:/usr/share/man:"
|
||||
export PATH=$PATH:$HOME/bin
|
||||
|
||||
if test "$UID" = 0; then
|
||||
PS1="\h:\w # "
|
||||
|
||||
# PS1="\h: # "
|
||||
else
|
||||
PS1="\u@\h:\w > "
|
||||
fi
|
||||
export PS1
|
||||
|
||||
export HISTCONTROL=ignoreboth
|
||||
|
||||
alias ls='ls --color=auto'
|
||||
|
||||
umask 022
|
||||
|
||||
# End of file
|
||||
@@ -0,0 +1,5 @@
|
||||
1.安装libcgroup和cgroups的图形界面
|
||||
sh ./install.sh
|
||||
2.启动cgroups的图形界面
|
||||
cg-gui
|
||||
|
||||
28
install_shell/cgroup-d5000-install/42-2014-01-15-062120/install.sh
Executable file
28
install_shell/cgroup-d5000-install/42-2014-01-15-062120/install.sh
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "Starting update kernel..."
|
||||
cd kernel
|
||||
tar xf update_kernel-2013-11-25_2.6.32.41-cgroup.tar.gz
|
||||
cd update_kernel-2013-11-25_2.6.32.41-cgroup
|
||||
./install.sh
|
||||
cd ..
|
||||
/bin/rm -rf update_kernel-2013-11-25_2.6.32.41-cgroup
|
||||
cd ..
|
||||
|
||||
echo "Starting upgrade cg-manager need package..."
|
||||
pkgrm cairo
|
||||
pkgadd -f cairo#1.8.4-x86_64-linx-Rocky4.3.pkg.tar.gz
|
||||
pkgrm gtk2
|
||||
pkgadd -f gtk2#2.14.7-x86_64-linx-Rocky4.3.pkg.tar.gz
|
||||
pkgrm jasper
|
||||
pkgadd -f jasper#1.900.1-x86_64-linx-Rocky4.3.pkg.tar.gz
|
||||
pkgrm pixman
|
||||
pkgadd -f pixman#0.12.0-x86_64-linx-Rocky4.3.pkg.tar.gz
|
||||
pkgrm libgtop2
|
||||
pkgadd -f libgtop2#2.28.1-x86_64-linx-Rocky4.3.pkg.tar.gz
|
||||
|
||||
echo "Starting install libcgroup and cg-manager package..."
|
||||
pkgrm libcgroup
|
||||
pkgadd -f libcgroup#0.38-x86_64-linx-Rocky4.3.pkg.tar.gz
|
||||
pkgrm cg-manager
|
||||
pkgadd -f cg-manager#1.0-x86_64-linx-Rocky4.3.pkg.tar.gz
|
||||
78
install_shell/cgroup-d5000-install/cgconfig.conf
Normal file
78
install_shell/cgroup-d5000-install/cgconfig.conf
Normal file
@@ -0,0 +1,78 @@
|
||||
#
|
||||
# Copyright IBM Corporation. 2007
|
||||
#
|
||||
# Authors: Balbir Singh <balbir@linux.vnet.ibm.com>
|
||||
# This program is free software; you can redistribute it and/or modify it
|
||||
# under the terms of version 2.1 of the GNU Lesser General Public License
|
||||
# as published by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it would be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
#group daemons/www {
|
||||
# perm {
|
||||
# task {
|
||||
# uid = root;
|
||||
# gid = webmaster;
|
||||
# }
|
||||
# admin {
|
||||
# uid = root;
|
||||
# gid = root;
|
||||
# }
|
||||
# }
|
||||
# cpu {
|
||||
# cpu.shares = 1000;
|
||||
# }
|
||||
#}
|
||||
#
|
||||
#group daemons/ftp {
|
||||
# perm {
|
||||
# task {
|
||||
# uid = root;
|
||||
# gid = ftpmaster;
|
||||
# }
|
||||
# admin {
|
||||
# uid = root;
|
||||
# gid = root;
|
||||
# }
|
||||
# }
|
||||
# cpu {
|
||||
# cpu.shares = 500;
|
||||
# }
|
||||
#}
|
||||
#
|
||||
#mount {
|
||||
# cpu = /mnt/cgroups/cpu;
|
||||
# cpuacct = /mnt/cgroups/cpuacct;
|
||||
#}
|
||||
group d5000_limits {
|
||||
perm {
|
||||
task {
|
||||
uid = d5000;
|
||||
gid = d5000;
|
||||
}
|
||||
admin {
|
||||
uid = sysadmin;
|
||||
gid = sysadmin;
|
||||
}
|
||||
}
|
||||
cpuset {
|
||||
cpuset.cpus = 0-0;
|
||||
cpuset.mems = 0-0;
|
||||
}
|
||||
memory {
|
||||
memory.limit_in_bytes = 900M;
|
||||
memory.memsw.limit_in_bytes = 962M;
|
||||
}
|
||||
}
|
||||
|
||||
mount {
|
||||
cpu = /lxcg;
|
||||
cpuset = /lxcg;
|
||||
cpuacct = /lxcg;
|
||||
memory = /lxcg;
|
||||
freezer = /lxcg;
|
||||
net_cls = /lxcg;
|
||||
devices = /lxcg;
|
||||
}
|
||||
76
install_shell/cgroup-d5000-install/cgrules.conf
Normal file
76
install_shell/cgroup-d5000-install/cgrules.conf
Normal file
@@ -0,0 +1,76 @@
|
||||
# /etc/cgrules.conf
|
||||
#
|
||||
#Each line describes a rule for a user in the forms:
|
||||
#
|
||||
#<user> <controllers> <destination>
|
||||
#<user>:<process name> <controllers> <destination>
|
||||
#
|
||||
#Where:
|
||||
# <user> can be:
|
||||
# - an user name
|
||||
# - a group name, with @group syntax
|
||||
# - the wildcard *, for any user or group.
|
||||
# - The %, which is equivalent to "ditto". This is useful for
|
||||
# multiline rules where different cgroups need to be specified
|
||||
# for various hierarchies for a single user.
|
||||
#
|
||||
# <process name> is optional and it can be:
|
||||
# - a process name
|
||||
# - a full command path of a process
|
||||
#
|
||||
# <controller> can be:
|
||||
# - comma separated controller names (no spaces)
|
||||
# - * (for all mounted controllers)
|
||||
#
|
||||
# <destination> can be:
|
||||
# - path with-in the controller hierarchy (ex. pgrp1/gid1/uid1)
|
||||
#
|
||||
# Note:
|
||||
# - It currently has rules based on uids, gids and process name.
|
||||
#
|
||||
# - Don't put overlapping rules. First rule which matches the criteria
|
||||
# will be executed.
|
||||
#
|
||||
# - Multiline rules can be specified for specifying different cgroups
|
||||
# for multiple hierarchies. In the example below, user "peter" has
|
||||
# specified 2 line rule. First line says put peter's task in test1/
|
||||
# dir for "cpu" controller and second line says put peter's tasks in
|
||||
# test2/ dir for memory controller. Make a note of "%" sign in second line.
|
||||
# This is an indication that it is continuation of previous rule.
|
||||
#
|
||||
#
|
||||
#<user> <controllers> <destination>
|
||||
#
|
||||
#john cpu usergroup/faculty/john/
|
||||
#john:cp cpu usergroup/faculty/john/cp
|
||||
#@student cpu,memory usergroup/student/
|
||||
#peter cpu test1/
|
||||
#% memory test2/
|
||||
#@root * admingroup/
|
||||
#* * default/
|
||||
# End of file
|
||||
bin * d5000_limits
|
||||
daemon * d5000_limits
|
||||
sys * d5000_limits
|
||||
audadmin * d5000_limits
|
||||
#sysadmin * d5000_limits
|
||||
secadmin * d5000_limits
|
||||
netadmin * d5000_limits
|
||||
nobody * d5000_limits
|
||||
mail * d5000_limits
|
||||
postfix * d5000_limits
|
||||
dhcp * d5000_limits
|
||||
named * d5000_limits
|
||||
httpd * d5000_limits
|
||||
squid * d5000_limits
|
||||
samba * d5000_limits
|
||||
#sshd * d5000_limits
|
||||
nfs * d5000_limits
|
||||
mysql * d5000_limits
|
||||
snort * d5000_limits
|
||||
ftp * d5000_limits
|
||||
cron * d5000_limits
|
||||
messagebus * d5000_limits
|
||||
mfs * d5000_limits
|
||||
#root:inetd * d5000_limits
|
||||
d5000 * d5000_limits
|
||||
25
install_shell/cgroup-d5000-install/install.sh
Executable file
25
install_shell/cgroup-d5000-install/install.sh
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
|
||||
USER_NAME=$1
|
||||
USER_HOME=$2
|
||||
USER_SHELL=$3
|
||||
#chmod 755 /root
|
||||
#update linx kernel
|
||||
#cd LXCG-RC3
|
||||
cd 42-2014-01-15-062120
|
||||
./install.sh
|
||||
cd ../
|
||||
pkginfo -i|grep numactl
|
||||
if [ $? -ne 0 ];then
|
||||
pkgadd -f numactl#2.0.3-x86_64-linx-Rocky4.2.pkg.tar.gz
|
||||
else
|
||||
pkgadd -f -u numactl#2.0.3-x86_64-linx-Rocky4.2.pkg.tar.gz
|
||||
fi
|
||||
#cp cgconfig.conf cgrules.conf /etc
|
||||
sed -i "s#d5000#${USER_NAME}#g" /etc/cgconfig.conf
|
||||
sed -i "s#d5000#${USER_NAME}#g" /etc/cgrules.conf
|
||||
grep ^${USER_NAME} /etc/security/limits.conf|grep nproc &>/dev/null
|
||||
if [ $? -ne 0 ];then
|
||||
echo "${USER_NAME} soft nproc 6000">>/etc/security/limits.conf
|
||||
echo "${USER_NAME} hard nproc 6000">>/etc/security/limits.conf
|
||||
fi
|
||||
Reference in New Issue
Block a user