#!/bin/bash
IP=`ifconfig ens33|head -2|tail -1|tr -s " "|cut -d " " -f3`
#yum安装nginx服务,并启动该服务
#yum安装nginx服务,并启动该服务
#!/bin/bash
#获取主机IP地址
IP=`ifconfig ens33|head -2|tail -1|tr -s " "|cut -d " " -f3`
echo "该主机的IP地址是:$IP"
#!/bin/bash
#获取主机IP地址
echo $IP >> /root/data/ip.txt
grep -q 3 /root/data/ip.txt
if [ $? = 0 ] ;then
else
groupadd magedu
for i in {00..99};do
useradd Magedu_$i
usermod -g magedu Magedu_$i
PASS=123456
echo $PASS | passwd --stdin Magedu_$i &> /dev/null
echo Magedu_$i:PASS >> /data/user.log
done
useradd Magedu_100
usermod -g magedu Magedu_100
PASS=123456
echo $PASS | passwd --stdin Magedu_$i &> /dev/null
echo Magedu_$i:PASS >> /data/user.log
echo "由于ip地址中不包含3,批量建立用户中...
Magedu_$i is created."
fi
#打印/etc/passwd中的可登录用户
echo 当前系统可登录用户:
grep -v nologin /etc/passwd|cut -d: -f1;
echo
#yum安装nginx服务,并启动该服务
echo 安装nginx服务中...
rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpmyum -y install nginx
echo nginx安装完毕!
systemctl start nginx
systemctl status nginx
echo nginx服务已启动!