set_common.sh
来源:互联网 发布:手绘图软件下载 编辑:程序博客网 时间:2024/05/21 11:27
cat setup_common.sh
#!/bin/sh
id ads
if [ $? -ne 0 ];then
sudo /usr/sbin/groupadd -g 1685 ads
sudo /usr/sbin/useradd -u 1685 -g ads -d /home/ads ads
fi
id admin
if [ $? -ne 0 ];then
sudo /usr/sbin/groupadd -g 500 admin
sudo /usr/sbin/useradd -u 500 -g admin -d /home/admin admin
fi
if [ `cat /etc/redhat-release 2>/dev/null|grep 'release 4'|wc -l` -eq 1 ];then
#ask password when cron to run with 'sudo '
sudo sed -i -e 's/^Defaults\s*requiretty/#Defaults requiretty/' /etc/sudoers
sudo sed -i 's/SELINUX=.*$/SELINUX=disabled/' /etc/selinux/config
sudo setenforce 0
fi
sudo sed -i -e 's/^Protocol 2.*$/Protocol 2,1/' /etc/ssh/sshd_config
sudo service sshd restart
scp -p 【hostname】:/home/zgq/cron1.ads.tgz ./ && sudo tar zxvf ./cron1.ads.tgz -C /
cat /etc/security/limits.conf|grep -v '^#'|grep core|grep unlimited || echo "
* - core unlimited
"|sudo tee -a /etc/security/limits.conf
cat /etc/security/limits.conf|grep -v '^#'|grep nofile || echo "
root soft nofile 65535
root hard nofile 65535
admin soft nofile 65535
admin hard nofile 65535
ads soft nofile 65535
ads hard nofile 65535
* soft nofile 16384
* hard nofile 357782
"|sudo tee -a /etc/security/limits.conf
echo '10 0 * * * root find /var/tmp -name "*-[0-9]*-[0-9]*.core" -mtime 7 -exec rm -f {} \; >/dev/null 2>&1 '|sudo tee /etc/cron.d/delete_corefile
if [ grep '^kernel.core_pattern' /etc/sysctl.conf >/dev/null 2>&1 ];then
sudo sed -i -e 's;^kernel.core_pattern\s*=.*;kernel.core_pattern = /var/tmp/%e-%p-%t.core;' /etc/sysctl.conf
else
echo "kernel.core_pattern = /var/tmp/%e-%p-%t.core" |sudo tee -a /etc/sysctl.conf
fi
hostname|egrep -e '^p[0-9]+.*.mm.cnz.alimama.com' && echo "#for webserver
net.ipv4.tcp_fin_timeout = 10
net.ipv4.ip_local_port_range = 1024 61000
net.core.rmem_default = 262144
net.core.wmem_default = 262144
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216
net.ipv4.tcp_max_syn_backlog = 16384
net.core.somaxconn = 16384
net.core.netdev_max_backlog = 8192
#net.ipv4.tcp_congestion_control = cubic
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
"|sudo tee -a /etc/sysctl.conf
if [ `echo $HOSTNAME|egrep 'p[0-9]'|wc -l ` -ge 1 ];then
#web server
echo "#to disable lv vip loop.ip apr:
net.ipv4.conf.lo.arp_ignore = 1
net.ipv4.conf.lo.arp_announce = 2
"|sudo tee -a /etc/sysctl.conf
fi
sudo sysctl -p
sudo service crond reload
#scp -p [hostname]~zgq/clone_config/p.ads.ssh.tgz ./
#sudo tar zxvf ~/p.ads.ssh.tgz -C /home/ads
#ntp sometime don't work
#sudo service ntpd stop
#sudo /usr/sbin/ntpdate ntp2.ops.cnz.alimama.com
#sudo service ntpd start
wget http://yum.corp.taobao.com/yum/yum-config && chmod +x yum-config && sudo ./yum-config
#scp -p [hostname]:~zgq/tools/walle ./
#!/bin/sh
id ads
if [ $? -ne 0 ];then
sudo /usr/sbin/groupadd -g 1685 ads
sudo /usr/sbin/useradd -u 1685 -g ads -d /home/ads ads
fi
id admin
if [ $? -ne 0 ];then
sudo /usr/sbin/groupadd -g 500 admin
sudo /usr/sbin/useradd -u 500 -g admin -d /home/admin admin
fi
if [ `cat /etc/redhat-release 2>/dev/null|grep 'release 4'|wc -l` -eq 1 ];then
#ask password when cron to run with 'sudo '
sudo sed -i -e 's/^Defaults\s*requiretty/#Defaults requiretty/' /etc/sudoers
sudo sed -i 's/SELINUX=.*$/SELINUX=disabled/' /etc/selinux/config
sudo setenforce 0
fi
sudo sed -i -e 's/^Protocol 2.*$/Protocol 2,1/' /etc/ssh/sshd_config
sudo service sshd restart
scp -p 【hostname】:/home/zgq/cron1.ads.tgz ./ && sudo tar zxvf ./cron1.ads.tgz -C /
cat /etc/security/limits.conf|grep -v '^#'|grep core|grep unlimited || echo "
* - core unlimited
"|sudo tee -a /etc/security/limits.conf
cat /etc/security/limits.conf|grep -v '^#'|grep nofile || echo "
root soft nofile 65535
root hard nofile 65535
admin soft nofile 65535
admin hard nofile 65535
ads soft nofile 65535
ads hard nofile 65535
* soft nofile 16384
* hard nofile 357782
"|sudo tee -a /etc/security/limits.conf
echo '10 0 * * * root find /var/tmp -name "*-[0-9]*-[0-9]*.core" -mtime 7 -exec rm -f {} \; >/dev/null 2>&1 '|sudo tee /etc/cron.d/delete_corefile
if [ grep '^kernel.core_pattern' /etc/sysctl.conf >/dev/null 2>&1 ];then
sudo sed -i -e 's;^kernel.core_pattern\s*=.*;kernel.core_pattern = /var/tmp/%e-%p-%t.core;' /etc/sysctl.conf
else
echo "kernel.core_pattern = /var/tmp/%e-%p-%t.core" |sudo tee -a /etc/sysctl.conf
fi
hostname|egrep -e '^p[0-9]+.*.mm.cnz.alimama.com' && echo "#for webserver
net.ipv4.tcp_fin_timeout = 10
net.ipv4.ip_local_port_range = 1024 61000
net.core.rmem_default = 262144
net.core.wmem_default = 262144
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216
net.ipv4.tcp_max_syn_backlog = 16384
net.core.somaxconn = 16384
net.core.netdev_max_backlog = 8192
#net.ipv4.tcp_congestion_control = cubic
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
"|sudo tee -a /etc/sysctl.conf
if [ `echo $HOSTNAME|egrep 'p[0-9]'|wc -l ` -ge 1 ];then
#web server
echo "#to disable lv vip loop.ip apr:
net.ipv4.conf.lo.arp_ignore = 1
net.ipv4.conf.lo.arp_announce = 2
"|sudo tee -a /etc/sysctl.conf
fi
sudo sysctl -p
sudo service crond reload
#scp -p [hostname]~zgq/clone_config/p.ads.ssh.tgz ./
#sudo tar zxvf ~/p.ads.ssh.tgz -C /home/ads
#ntp sometime don't work
#sudo service ntpd stop
#sudo /usr/sbin/ntpdate ntp2.ops.cnz.alimama.com
#sudo service ntpd start
wget http://yum.corp.taobao.com/yum/yum-config && chmod +x yum-config && sudo ./yum-config
#scp -p [hostname]:~zgq/tools/walle ./
- set_common.sh
- sh
- weblogstop.sh
- man sh
- stopMS01.sh
- stopAdmin.sh
- RunWebserver.sh
- 20070910sh
- .sh打包
- create_db_sybase.sh
- svn_install_script.sh
- GendaTa.sh
- mkview.sh
- mksmbpasswd.sh
- sh string
- makeFigures.sh
- ora_full_backup.sh
- ora_arch_backup.sh
- 螺旋矩阵(c实现)
- 几种不同语言版本的HMM实现
- NUnit菜鸟使用向导
- 调试makefile
- linux 0.11 学习笔记1
- set_common.sh
- 打开表单时提示无法验证发布者iSignatureHTML.
- 排序算法二(归并排序、快速排序、希尔排序)
- Linux学习笔记——Linux常用命令—其他常用命令
- ASP.NET利用AJAX Extensions控件实现页面的局部动态刷新
- android自定义控件(基于原有控件,即继承自view)
- dots and boxes
- android proguard
- POJ2247 Humble Numbers