###################################################  CentOS6.5                                                                                         ##  initialize the Linux system to deploy lnmp                                              ##  2016/10/30 22:58                                                                              ## author:kangjie                                                                                   #
# original article                                           ####################################################!/bin/sh#向自动化运维迈进#定义文件位置LOG_PATH=/server/initlogLOG_FILE=$LOG_PATH/init.logi=0#如果文件夹不存在,则创建[ ! -d /server/tools ] && mkdir -p /server/tools[ ! -d $LOG_PATH ] && mkdir -p $LOG_PATH #判断命令执行是否成功#check status then wirite to logfunction check(){if [ $? != 0 ] thenecho "××××-operate $1 Failed!!!-×××" >> $LOG_FILE else echo "√√√-operate $1 Success-√√√" >> $LOG_FILEfi} #关闭防火墙,禁止开机启动(仅限于没有公网的情况)#iptablesfunction iptable(){/etc/init.d/iptables stopcheck iptables chkconfig iptables off check chkconfig-iptables((i++))} #关闭selinux,修改配置文件后,同时设置临时生效#selinux  disable the selinuxfunction selinux(){status=`grep SELINUX= /etc/selinux/config | tail -1 | awk -F '='  '{print $2}'`if [ $status != disabled ]thensed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/configstatus=`grep SELINUX= /etc/selinux/config | tail -1 | awk -F '='  '{print $2}'`if [ $status == disabled ]thenecho "√√√-Modify selinux config success-√√√-" >> $LOG_FILEelseecho "××××-Modify selinux config Failed!!!-××××" >> $LOG_FILEfielseecho &qu