Skip to content

Instantly share code, notes, and snippets.

@kirkins
Created April 25, 2018 22:15
Show Gist options
  • Save kirkins/4bb19ce0c7f5a8a359520df311bd1c17 to your computer and use it in GitHub Desktop.
Save kirkins/4bb19ce0c7f5a8a359520df311bd1c17 to your computer and use it in GitHub Desktop.
A docker file running a simple script to check if a port is open every 15 seconds
FROM alpine
MAINTAINER kirkins@gmail.com
# Checks if a port is open every 15 seconds
# Set the following variables
ENV WEBSITE google.com
ENV PORT 777
ENV PORT_DOWN_MSG 'Port is down send this message via email/text/ect'
# Replace echo with a script to email, text, or discord message
CMD watch -n 15 'nc -z -w5 $WEBSITE $PORT \
|| echo $PORT_DOWN_MSG'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment