#! /bin/bash # harmless (does not change anything, just checks) script # run anytime to check various system settings . /usr/src/mor/framework/bash_functions.sh k_config_details # ---- VARS ----- VERSION="1.2.1" SCRIPT_NAME="MOR System Check" TEST=0 # 1 - do not execute changes DIR="/usr/src/mor/x16" KF="/usr/src/k_framework" # ---- FUNCTIONS ----- # ---- MAIN ----- report "" 7 k_start if [ "$TEST" == "1" ]; then report "***** TEST MODE ON. Changes will not be applied *****" 8 fi if (( centos_version != 7 )); then report "Centos 7 is recommended. Current Centos: $centos_version" 2 fi if ! k_are_we_root; then report "Run script as root" 1 k_exit 1 fi # checks if (( centos_version == 6 )); then echo && cd $KF/checks && ./centos_repos_check.sh res=$?;if [[ $res != 0 && $EXIT_CODE != 1 ]]; then EXIT_CODE=$res; fi fi echo && cd $DIR/maintenance/checks && ./config_check.sh res=$?;if [[ $res != 0 && $EXIT_CODE != 1 ]]; then EXIT_CODE=$res; fi echo && cd $DIR/maintenance/checks && ./asterisk_check.sh res=$?;if [[ $res != 0 && $EXIT_CODE != 1 ]]; then EXIT_CODE=$res; fi echo && cd $DIR/maintenance/checks && ./services_check.sh res=$?;if [[ $res != 0 && $EXIT_CODE != 1 ]]; then EXIT_CODE=$res; fi echo && cd $DIR/maintenance/checks && ./scripts_check.sh res=$?;if [[ $res != 0 && $EXIT_CODE != 1 ]]; then EXIT_CODE=$res; fi echo && cd $DIR/maintenance/checks && ./various_check.sh res=$?;if [[ $res != 0 && $EXIT_CODE != 1 ]]; then EXIT_CODE=$res; fi echo && cd $DIR/maintenance/checks && ./ccl_check.sh res=$?;if [[ $res != 0 && $EXIT_CODE != 1 ]]; then EXIT_CODE=$res; fi echo && cd $DIR/maintenance/checks && ./db_integrity_check.sh res=$?;if [[ $res != 0 && $EXIT_CODE != 1 ]]; then EXIT_CODE=$res; fi echo && cd $KF/checks && ./packets_check.sh res=$?;if [[ $res != 0 && $EXIT_CODE != 1 ]]; then EXIT_CODE=$res; fi echo && cd $KF/helpers/zabbix && ./zabbix_agent_check.sh res=$?;if [[ $res != 0 && $EXIT_CODE != 1 ]]; then EXIT_CODE=$res; fi echo && cd $KF/checks && ./cron_check.sh res=$?;if [[ $res != 0 && $EXIT_CODE != 1 ]]; then EXIT_CODE=$res; fi # checks memcached on all servers. Allowed only on GUI server by CHECK_SERVER_TYPE option echo && cd $KF/helpers/memcached && ./memcached_check.sh CHECK_SERVER_TYPE res=$?;if [[ $res != 0 && $EXIT_CODE != 1 ]]; then EXIT_CODE=$res; fi if [[ $GUI_PRESENT == 1 ]]; then echo && cd $DIR/maintenance/checks && ./gui_check.sh res=$?;if [[ $res != 0 && $EXIT_CODE != 1 ]]; then EXIT_CODE=$res; fi echo && cd $KF/checks && ./apache_check.sh res=$?;if [[ $res != 0 && $EXIT_CODE != 1 ]]; then EXIT_CODE=$res; fi fi if [[ $ES_PRESENT == 1 ]]; then echo && cd $KF/helpers/elasticsearch && ./es_check.sh res=$?;if [[ $res != 0 && $EXIT_CODE != 1 ]]; then EXIT_CODE=$res; fi fi echo && cd $DIR/maintenance/checks && ./security_check.sh res=$?;if [[ $res != 0 && $EXIT_CODE != 1 ]]; then EXIT_CODE=$res; fi echo k_check_status_update $EXIT_CODE k_exit $EXIT_CODE