[refactor] grep file instead of piping cat to grep

This commit is contained in:
William Wernert
2020-04-18 18:08:33 -04:00
parent 789173be98
commit 6d3bc4ec1d
2 changed files with 5 additions and 4 deletions

View File

@@ -314,6 +314,7 @@ collect_webuser_inputs() {
fi fi
done done
} }
configure_minion() { configure_minion() {
# You have to pass the TYPE to this function so it knows if its a master or not # You have to pass the TYPE to this function so it knows if its a master or not

View File

@@ -34,11 +34,11 @@ export PATH=$PATH:../salt/common/tools/sbin
# Global Variables # Global Variables
HOSTNAME=$(cat /etc/hostname) HOSTNAME=$(cat /etc/hostname)
TOTAL_MEM=`grep MemTotal /proc/meminfo | awk '{print $2}' | sed -r 's/.{3}$//'` TOTAL_MEM=$(grep MemTotal /proc/meminfo | awk '{print $2}' | sed -r 's/.{3}$//')
NICS=$(ip link | awk -F: '$0 !~ "lo|vir|veth|br|docker|wl|^[^0-9]"{print $2 " \"" "Interface" "\"" " OFF"}') NICS=$(ip link | awk -F: '$0 !~ "lo|vir|veth|br|docker|wl|^[^0-9]"{print $2 " \"" "Interface" "\"" " OFF"}')
CPUCORES=$(cat /proc/cpuinfo | grep processor | wc -l) CPUCORES=$(grep -c "processor" /proc/cpuinfo)
LISTCORES=$(cat /proc/cpuinfo | grep processor | awk '{print $3 " \"" "core" "\""}') LISTCORES=$(grep "processor" /proc/cpuinfo | awk '{print $3 " \"" "core" "\""}')
RANDOMUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1) RANDOMUID=$(</dev/urandom tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1)
NODE_ES_PORT="9200" NODE_ES_PORT="9200"
SETUPLOG="/root/sosetup.log" SETUPLOG="/root/sosetup.log"
# End Global Variables # End Global Variables