码迷,mamicode.com
首页 > 系统相关 > 详细

linux常用命令

时间:2019-11-11 19:54:32      阅读:62      评论:0      收藏:0      [点我收藏+]

标签:and   lin   The   roc   cookie   mys   icmp   done   str   

echo "ulimit -n 204800" >> /etc/profile
source /etc/profile

# 检查ping,开启
PING=$(cat cat /proc/sys/net/ipv4/icmp_echo_ignore_all)
if [ $PING -ne 0 ]; then
echo 0 > /proc/sys/net/ipv4/icmp_echo_ignore_all
sysctl -p
fi

# 杀掉已连接sshd
if netstat -antp | grep sshd | grep -wq ESTABLISHED ; then
pid=$(netstat -antp | grep sshd | grep -w ESTABLISHED | awk ‘{print $7}‘ | cut -d‘/‘ -f1)
for i in $pid ; do
kill -9 $i
done
fi

# tcp重用和快速回收
echo "net.ipv4.tcp_syncookies = 1" >> /etc/sysctl.conf
echo "net.ipv4.tcp_tw_reuse = 1" >> /etc/sysctl.conf
echo "net.ipv4.tcp_tw_recycle = 1" >> /etc/sysctl.conf
sysctl -p

ip=$(ifconfig | grep -w inet | grep -v 127 | awk ‘{print $2}‘)

# httpd配置
cat << EOF >> /etc/httpd/conf/httpd.conf

ExtendedStatus On
<Location /server-status>
SetHandler server-status
Order deny,Allow
Deny from all
Allow from 127.0.0.1
</Location>
EOF

# mariadb配置
sed -i ‘/^[mysqld]$/a\bind-address=192.168.26.60‘ /etc/my.cnf

linux常用命令

标签:and   lin   The   roc   cookie   mys   icmp   done   str   

原文地址:https://blog.51cto.com/14075442/2449351

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!