Generic improvements for debug status, and cleaning up code

This commit is contained in:
mboelen 2016-04-02 18:28:53 +02:00
parent cab2b9071c
commit 95944c0035
1 changed files with 12 additions and 18 deletions

View File

@ -22,10 +22,6 @@
#
#################################################################################
#
# Status of database processes
MYSQL_RUNNING=0
ORACLE_RUNNING=0
POSTGRESQL_RUNNING=0
# Paths to DATADIR
sMYSQLDBPATHS="/var/lib/mysql"
# Paths to my.cnf
@ -41,12 +37,13 @@
if [ ${SKIPTEST} -eq 0 ]; then
FIND=`${PSBINARY} ax | egrep "mysqld|mysqld_safe" | grep -v "grep"`
if [ "${FIND}" = "" ]; then
Display --indent 2 --text "- MySQL process status" --result "NOT FOUND" --color WHITE
if [ ${DEBUG} -eq 1 ]; then Display --indent 2 --text "- MySQL process status" --result "NOT FOUND" --color WHITE --debug; fi
LogText "Result: MySQL process not active"
else
Display --indent 2 --text "- MySQL process status" --result "FOUND" --color GREEN
LogText "Result: MySQL is active"
MYSQL_RUNNING=1
Report "mysql_running=${MYSQL_RUNNING}"
fi
fi
#
@ -96,14 +93,14 @@
# Description : Check if PostgreSQL is being used
Register --test-no DBS-1826 --weight L --network NO --description "Checking active PostgreSQL processes"
if [ ${SKIPTEST} -eq 0 ]; then
FIND=`${PSBINARY} ax | grep "postgres:" | grep -v "grep"`
if [ "${FIND}" = "" ]; then
Display --indent 2 --text "- PostgreSQL processes status" --result "NOT FOUND" --color WHITE
LogText "Result: PostgreSQL process not active"
else
if IsRunning "postgres:"; then
Display --indent 2 --text "- PostgreSQL processes status" --result "FOUND" --color GREEN
LogText "Result: PostgreSQL is active"
POSTGRESQL_RUNNING=1
Report "postgresql_running=${POSTGRESQL_RUNNING}"
else
if [ ${DEBUG} -eq 1 ]; then Display --indent 2 --text "- PostgreSQL processes status" --result "NOT FOUND" --color WHITE --debug; fi
LogText "Result: PostgreSQL process not active"
fi
fi
#
@ -123,12 +120,13 @@
if [ ${SKIPTEST} -eq 0 ]; then
FIND=`${PSBINARY} ax | egrep "ora_pmon|ora_smon|tnslsnr" | grep -v "grep"`
if [ "${FIND}" = "" ]; then
Display --indent 2 --text "- Oracle processes status" --result "NOT FOUND" --color WHITE
if [ ${DEBUG} -eq 1 ]; then Display --indent 2 --text "- Oracle processes status" --result "NOT FOUND" --color WHITE --debug; fi
LogText "Result: Oracle process(es) not active"
else
Display --indent 2 --text "- Oracle processes status" --result "FOUND" --color GREEN
LogText "Result: Oracle is active"
ORACLE_RUNNING=1
Report "oracle_running=${ORACLE_RUNNING}"
fi
fi
#
@ -153,22 +151,18 @@
Display --indent 2 --text "- DB2 instance running" --result "FOUND" --color GREEN
LogText "Result: At least one DB2 instance is running"
DB2_RUNNING=1
Report "db2_running=${DB2_RUNNING}"
else
if [ ${DEBUG} -eq 1 ]; then Display --indent 2 --text "- DB2 instance running" --result "NOT FOUND" --color WHITE; fi
if [ ${DEBUG} -eq 1 ]; then Display --indent 2 --text "- DB2 instance running" --result "NOT FOUND" --color WHITE --debug; fi
LogText "Result: No DB2 instances are running"
fi
fi
#
#################################################################################
#
Report "mysql_running=${MYSQL_RUNNING}"
Report "oracle_running=${ORACLE_RUNNING}"
Report "postgresql_running=${POSTGRESQL_RUNNING}"
Report "db2_running=${DB2_RUNNING}"
wait_for_keypress
#
#================================================================================
# Lynis - Copyright 2007-2016, Michael Boelen - www.rootkit.nl - The Netherlands
# Lynis - Security Auditing and System Hardening for Linux and UNIX - https://cisofy.com