#! /bin/bash # Rocky9 compatible . /usr/src/k_framework/main.sh SCRIPT_NAME="Tuned installation" VERSION="1.1.3" k_start if [ ! -f /usr/sbin/tuned-adm ]; then yum install -y tuned fi if ! k_service_is_running tuned; then report "tuned not running, starting" 3 k_service_start tuned fi if ! k_service_check_enabled tuned; then report "tuned not activated, fixing" 3 k_service_enable tuned fi k_detect_os current_profile=`tuned-adm active | awk -F ":" '{print $2}' | xargs` report "OS: $OS $DIST Current profile: $current_profile" 3 # network-latency takes a lot of CPU on Centos 7 for Asterisk 15, latency-performance is used with much lower load-average # using latency-performance for time beying until tests show otherwise # select which profile to use if [ $OS == "centos" ] && [ $DIST == "6" ]; then profile="network-latency" else profile="latency-performance" fi if [ $profile != $current_profile ]; then if tuned-adm list | grep -q "$profile"; then report "Setting tuned $profile profile" 3 tuned-adm profile $profile else report "tuned $profile profile not available" 2 if tuned-adm list | grep -q "latency-performance"; then report "Setting tuned latency-performance profile" 3 tuned-adm profile latency-performance else report "tuned latency-performacen profile not available" 1 report "What kind of system are you using? Ping MK" 1 EXIT_CODE=1 fi fi else report "Correct tuned $profile profile already set" 0 fi k_exit $EXIT_CODE