Verifying the Ubuntu Apt Proxy Server is Running

I wanted a scriptable way to verify my Ubuntu Apt Proxy Server virtual machine was running correctly on my LAN server. A simple test is verifying port 3142 is open.

One method is using nmap with the -p option.

nmap -p 3142 ${IP_ADDRESS or $HOSTNAME}

Using nmap in this manner requires testing the output for an open state.

Another option is using the nc command with the -z option.

nc -z ${IP_ADDRESS or $HOSTNAME} 3142

When the port is open the nc command exits with an exit code of 0. When the port is not open the exit code is 1.

I decided to use the nc command. A script wrapper with a system email notifies me when the port is not open.

Posted: Category: Tutorial Tagged: Ubuntu, Virtual Machines

Next: Installing Ubuntu 32-bit In VirtualBox

Previous: Being Infected With Malware