初始化CentOS系统的初始化脚本
#!/bin/bash
#
#********************************************************************
#Author: kjAlbert
#Date: 2019-10-11
#FileName: sysinit.sh
#Description: Init CentOS Linux system
#Copyright (C): 2019 All rights reserved
#********************************************************************
#
#检测root权限
if [ $UID -ne 0 ];then
echo "没有root权限,无法执行!"
exit 1
fi
#检测version
if [ -e /etc/redhat-release ];then
VER=`sed -nr 's@.* ([0-9]).*@1@p' /etc/redhat-release`
else
echo '这不是redhat和centos系列的系统,请使用其他脚本!!'
exit 10
fi
bak=bak`date +%F_%T`
#cenos6:
case $VER in
6)
#firewalld
service iptalbes stop &>/dev/null
chkconfig iptables off &>/dev/null
echo "关闭防火墙完成"
#selinux
sed -i 's@SELINUX=enforcing@SELINUX=disabled@' /etc/selinux/config &>/dev/null
echo "关闭SELINUX完成"
#PS1
echo 'PS1="