linux在shell脚本中添加计划任务
(echo "*/10 * * * * /usr/sbin/ntpdate ntp1.aliyun.com";crontab -l)|crontab
centos7.x关闭 /var/spool/mail/root 邮件提示
echo "unset MAILCHECK">> /etc/profile
centos7.x 关闭防火墙
sed -i 's/SELINUX=.*/SELINUX=disabled/' /etc/selinux/config
systemctl disable firewalld.service
systemctl stop firewalld.service
centos7.x 关闭postfix
systemctl stop postfix
systemctl disable postfix
centos7.x修改时区为shanghai
rm -f /etc/localtime && cp -a /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
centos7.x 修改最大用户进程数
sed -i 's/4096/65535/' /etc/security/limits.d/20-nproc.conf
centos7.x修改最大文件打开数
echo '* soft nofile 65535' >> /etc/security/limits.conf
echo '* hard nofile 65535' >> /etc/security/limits.conf
关闭swap分区
swapoff -a
sed -i '/swap/d' /etc/fstab
文件包含限制一个进程可以拥有的VMA(虚拟内存区域)的数量。虚拟内存区域是一个连续的虚拟地址空间区域
echo 'vm.max_map_count = 262144' >> /etc/sysctl.conf
sysctl -p