#!/bin/bash


ip_list=($(cat ip.txt))
single_ip=()

for ip in ${ip_list[@]}
do 
    Rrst=$(echo ${single_ip[@]} | grep -q $ip)
    if [[ $Rrst -ne 0 ]]
    then
        single_ip+=($ip)
    fi 
done

for ip in ${single_ip[@]}
do
    timss=$(cat ip.txt | grep -l $ip)
    echo "$ip 访问的次数为 $timss"
done 



if [[ ${linuxRelease} = "ubuntu" ]] ;then echo yes;else echo no;fi

mv /etc/yum.repos.d/bak/* /etc/yum.repos.d/
rm -rf /etc/yum.repos.d/bak /etc/yum.repos.d/elrepo.repo
yum clean call
yum makecache
cd /root/linux-init
./custom-init.sh


OLD_MYSQL=(mysql MySQL mariadb)
for item in ${OLD_MYSQL[@]}
do
	rpm -qa | grep ${item}
done

mysql
root@localhost
v2ryStr@ngPa.ss

sed -i "/skip-grant-tables/ d" /etc/my.cnf

docker run \
  -u root \
  -d \
  -p 8080:8080 \
  -p 50000:50000 \
  -v /root/jenkins-data:/var/jenkins_home \
  -v /var/run/docker.sock:/var/run/docker.sock \
  jenkinsci/blueocean


  gitee all_access_token

  47c3f65b7d7539a90f016362a9082ff9


if [[ ${LinuxReleaseVersion} == "centos" ]];then echo "yes";else echo "no";fi

kk logs -n kube-ops ${$(kk -n kube-ops get pods | grep jenkins-work-slave| awk '{print$1}')[@]}

hostnamectl set-hostname tourism-worker-node-1

echo "192.168.12.53 aiboxhb.cdcyy.cn" >>/etc/hosts

heketi-cli --server http://tourism-glusterfs-storage-1:8080 --user admin --secret aCs1dGnaloa8Sadd cluster list

heketi-cli topology load --user admin --secret aCs1dGnaloa8Sadd --json=/etc/heketi/topology.json

FileName="maven-repository"
for i in /home/gfs-data /opt/gfs-data /data/gfs-data ; do
    ls $i | grep -qw ${FileName}
    if [[ $? -eq 0 ]]; then
        echo $i
        cd $i
        ls $i
    fi
done

echo "export  JAVA_HOME=/opt/java/openjdk/" >>/etc/profile
echo "export  MAVEN_HOME=/usr/local/maven3" >>/etc/profile
echo "export  PATH=${PATH}:${JAVA_HOME}/bin:${MAVEN_HOME}/bin" >>/etc/profile
ln -s /usr/local/maven3/bin/mvn /usr/bin/mvn

keadm init --advertise-address=192.168.35.24 --kubeedge-version=1.3.1 --kube-config=/root/.kube/config

echo "151.101.108.133 raw.githubusercontent.com" >>/etc/hosts

LinuxReleaseVersion="ubuntu"
if [ $LinuxReleaseVersion = "ubuntu" ]; then
  echo yes
else
  echo no
fi

SSHLoginPort=22333
sed -i "/^#Port 22/a Port ${SSHLoginPort}" /etc/ssh/sshd_config

#!/bin/bash

# 判断命令是否存在
command_exists() {
	command -v "$@" >/dev/null 2>&1
}

# 获取服务器的IP地址
get_server_ip() {
	local server_ip=""
	local Network_Manage_Tool=""

	if command_exists ip; then
		Network_Manage_Tool="$(ip addr)"
	elif command_exists ifconfig; then
		Network_Manage_Tool="$(ifconfig)"
	fi

	server_ip=$(echo "$Network_Manage_Tool" | \
		grep -oE "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}" | \
		grep -vE "^192\.168|^172\.1[6-9]\.|^172\.2[0-9]\.|^172\.3[0-2]\.|^10\.|^127\.|^255\.|^0\." | \
		head -n 1)

	# 自动获取失败时，通过网站提供的 API 获取外网地址
	if [ -z "$server_ip" ]; then
		 server_ip="$(wget -qO- --no-check-certificate https://ipv4.icanhazip.com)"
	fi

	echo "$server_ip"
}

get_server_ip

for i in {3..1..-1}
do
  echo "倒计时开始-- $i s --，准备切换shell，上文的日志输出将会消失！！"
  sleep 1
done

for namespace in $(kubectl get ns | awk '{print $1}' | grep -v "NAME")
do
  echo $namespace
  kubectl get pods -n $namespace | grep Evicted |awk '{print $1}' |xargs kubectl -n $namespace delete pod --force
done

echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDF7nRu6T9xj8qQzU8EtDFq4NXpgOPIF1CVFID5yhE+VHuXi+ZgaUa7ZSRBIod3I2wRh0HrmzH+cvlvDHmSZtyzxo8JDUkvJbdU037plMp9b0rB0OkVYL60lNRaEs6H4JTydxb9yQvi70GRv+UEz6wu/Xql3gexdLuNoHMbuPjkht3DLeufOws9CfZod70CT/zGHqTWLfSkvxIc5MFJhSo70jO1S7ADRri/2u4JXfFPTqRDdZ2PCPa/4CVFp3JA/ITjgk+HalQ/e+S46DQu7kY8aea4Mjqe6XQXrbISQ/wuBUqu2qF0TV23UWwjqdZlhSwGGiCikd/RiAjEOo2+NuOr root@rke-master" \
>> ~/.ssh/authorized_keys


PrivateServerIPs=(10.170.0.8)
DOCKER_VERSION=19.03.8
for ip in ${PrivateServerIPs[@]}
do
  echo "正在将Docker的离线安装包分发至主机 ${ip} 上……"
  scp -r /tmp/docker-${DOCKER_VERSION} root@$ip:/tmp/docker-${DOCKER_VERSION}
  echo  "Docker离线安装包已经分发完成！"
  echo  "----------------------------------------------------------"
done

mkdir rancher
cd rancher/
vim 0.0-extend-disk.sh

chmod +x 0.0-extend-disk.sh
./0.0-extend-disk.sh

umount /var
sed -i "s/\/var/\/var\/lib\/docker/g" /etc/fstab
mount -a

sed -i "s/\/data/\/var\/lib\/docker/g" /etc/fstab


