#!/bin/bash # Time : Thu 29 Nov 2018 02:01:46 PM CST # # Version: 1.0 # Notes : Cent0S 7 # # Author : linyaohong # Blog : ************ # Qq : 122123498 export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin cred="\E[31m" cgreen="\E[32m" cyellow="\E[33m" cblue="\E[34m" cmagenta="\E[35m" ccyan="\E[36m" sred="\E[31;5m" sbred="\E[41;5m" cend="\E[0m" ninx_ver=1.8.0 nginx_install_dir=/usr/local/nginx run_user=www # Check if user is root #[ $(id -u) != "0" ] && { echo "Error: You must be root to run this script"; exit 1; } if [ $(id -u) != "0" ]; then echo "Error: You must be root to run this script" exit 1 fi # check_os CentOS_ver=$(lsb_release -sr | awk -F. '{print $1}') if [ ${CentOS_ver} != "7" ]; then echo "Error: You must be Centos7 to run this script" exit 1 fi THREAD=$(grep 'processor' /proc/cpuinfo | sort -u | wc -l) id -u ${run_user} >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /sbin/nologin ${run_user} [ ! -d "${nginx_install_dir}" ] && mkdir -p ${nginx_install_dir}