大型项目环境预检查脚本,根据自己实际情况修改脚本中变量,给大家一个思路,转载请注明出处~
转至:https://www.cnblogs.com/gaohongyu/p/13738526.html
#!/usr/bin/env bash root=$( cd $(dirname $0) pwd ) source "$root"/dragonrc CPU=$(echo "`cat /proc/cpuinfo | grep "physical id" | uniq | wc -l`H") MEM=$(echo "$((`cat /proc/meminfo | grep MemTotal |awk '{print $2}'` / 1000000))G") TIME=$(date) rpm -q ansible &> /dev/null if [ $? -ne 0 ];then sh ${root}/scripts/install_ansible.sh &> /dev/null fi HINT(){ read -p "请按回车继续:" } COPY_KEY(){ echo echo sh ${root}/scripts/copy-key.sh echo echo } CK_UMASK(){ UMASK_NUM=$(ansible dragon -m shell -a "umask"|grep 0022|wc -l) ALL_HOSTS=$(echo "${ALL_NODES}"|awk -F"," '{for(i=1;i<=NF;i++) print $i}'|wc -l) echo echo -e "