This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#For this script to run first run top command. press 1 to see core information. Press W to set this a default | |
#hostname is a parametre | |
NUM_CPUS=$(top -bn 1 | grep -c "Cpu") | |
while true; | |
do | |
top -bn 2 | grep -o "Cpu.........." | tail -n $NUM_CPUS > /tmp/topLog.txt; | |
sed -e "s/Cpu[[:alnum:]] : //g" -e "s/Cpu[[:alnum:]][[:alnum:]] : //g" -e "s/ //g" /tmp/topLog.txt > /tmp/topLog2.txt; |