Skip to content

Instantly share code, notes, and snippets.

@alen-z
Last active September 27, 2024 08:25
Show Gist options
  • Save alen-z/45550c42d19ba93264661812452aaf00 to your computer and use it in GitHub Desktop.
Save alen-z/45550c42d19ba93264661812452aaf00 to your computer and use it in GitHub Desktop.
CUPS check
#!/bin/bash
# ANSI color codes
RED='\033[0;31m'
NC='\033[0m' # No Color
check_port_631() {
if lsof -i :631 2>/dev/null | grep -qE "LISTEN|:631" || netstat -anu 2>/dev/null | grep -q ":631"; then
echo -e "${RED}Port 631 UDP is open. Action required!${NC}"
else
echo "Port 631 UDP is closed. All good."
fi
}
check_port_631
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment