Skip to content

Commit

Permalink
Merge pull request cloudkick#37 from mago0/master
Browse files Browse the repository at this point in the history
I didn't see any script that would just do a simple check to see that a port was open and the native cloudkick http/https checks don't do localhost
  • Loading branch information
Felix Sargent committed Dec 16, 2011
2 parents 3a9585e + d699a30 commit a2e1731
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions simple_port_check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

# Cloudkick plugin to check that a port is open.
# Alerts if a connection cannot be established.

# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# <matt@williams-tech.net> wrote this file. As long as you retain this notice you
# can do whatever you want with this stuff. If we meet some day, and you think
# this stuff is worth it, you can buy me a beer in return
# ----------------------------------------------------------------------------

if [ $# -ne 1 ]; then
echo "Usage: $0 <port>"
exit
fi

PORT=$1

nc 127.0.0.1 $PORT </dev/null
if [ $? -ne 0 ]; then
echo "status err no server listening!"
else
echo "status ok ok"
fi

0 comments on commit a2e1731

Please sign in to comment.