#!/bin/bash # --- Script: /usr/local/sbin/commtest # --- Permissions: Ensure you execute 'chmod 0700 commtest' # --- Author: Paul Greene # --- Objective: Verify ports are open to or on your server for applications to run # --- Notes: This will simply output PASS or FAILED. Ensure nmap is installed. # --- Verify Network communication is open to your MySQL Database echo "" echo "TEST 1 - Verify Network communication is open to DB" portchk=`nmap -v -p 3306 localhost | awk '{print $2}' | awk 'NR==6'` if [ "$portchk" = "open" ]; then echo "MySQL port 3306 is open to web server ...PASSED" else echo "MySQL port 3306 is closed to web server ...FAILED" fi