Start to refine tests and clean up code.

This commit is contained in:
Dan Schaper 2016-10-28 15:37:45 -07:00
parent d9a16b0ff4
commit 9cd830b6aa

View file

@ -68,10 +68,6 @@ log_echo() {
echo "${2}" echo "${2}"
log_write "${2}" log_write "${2}"
;; ;;
-e)
echo "${2}"
log_write
;;
*) *)
echo "::: ${1}" echo "::: ${1}"
log_write "${1}" log_write "${1}"
@ -87,7 +83,7 @@ header_write() {
file_parse() { file_parse() {
while read -r line; do while read -r line; do
if [ ! -z "${line}" ]; then if [ ! -z "${line}" ]; then
[[ "${line}" =~ ^#.*$ ]] && continue [[ "${line}" =~ ^#.*$ || ! "${line}" ]] && continue
log_write "${line}" log_write "${line}"
fi fi
done < "${1}" done < "${1}"
@ -101,15 +97,13 @@ block_parse() {
lsof_parse() { lsof_parse() {
local user local user
local process local process
local match
user=$(echo ${1} | cut -f 3 -d ' ' | cut -c 2-) user=$(echo ${1} | cut -f 3 -d ' ' | cut -c 2-)
process=$(echo ${1} | cut -f 2 -d ' ' | cut -c 2-) process=$(echo ${1} | cut -f 2 -d ' ' | cut -c 2-)
if [[ ${2} -eq ${process} ]]; then [[ ${2} -eq ${process} ]] \
echo "::: Correctly configured." && echo "::: Correctly configured." \
else || log_echo "::: Failure: Incorrectly configured daemon."
log_echo "::: Failure: Incorrectly configured daemon."
fi
log_write "Found user ${user} with process ${process}" log_write "Found user ${user} with process ${process}"
} }
@ -333,8 +327,6 @@ distro_check || echo "Distro Check soft fail"
processor_check || echo "Processor Check soft fail" processor_check || echo "Processor Check soft fail"
ip_check ip_check
#hostnameCheck
daemon_check lighttpd http daemon_check lighttpd http
daemon_check dnsmasq domain daemon_check dnsmasq domain