#!/usr/bin/env bash fatal(){ echo "" echo -e "Error: $*" echo "" echo -e "\tScript terminated.." echo "" exit 1 } ## - Number of processors ## - declare -i number_processors=`grep -E "processor\s+:\s+" /proc/cpuinfo -c` if [ -n "$number_processors" -o $number_processors -eq 0 ]; then fatal 'Detecting number of prozessors failed!' fi if [ $number_processors -gt 8 ]; then threshod_1_min=`echo "$number_processors / 2" | bc` threshod_10_min=`echo "$number_processors / 3" | bc` threshod_15_min=`echo "$number_processors / 3" | bc` else threshod_1_min=`echo "$number_processors"` threshod_10_min=`echo "$number_processors /1.5"` fi threshod_15_min=$threshod_10_min