diff --git a/src/bin/Makefile b/src/bin/Makefile
new file mode 100644
index b4dfdba..5092503
*** a/src/bin/Makefile
--- b/src/bin/Makefile
*************** top_builddir = ../..
*** 14,20 ****
  include $(top_builddir)/src/Makefile.global
  
  SUBDIRS = initdb pg_ctl pg_dump \
! 	psql scripts pg_config pg_controldata pg_resetxlog pg_basebackup
  
  ifeq ($(PORTNAME), win32)
  SUBDIRS += pgevent
--- 14,21 ----
  include $(top_builddir)/src/Makefile.global
  
  SUBDIRS = initdb pg_ctl pg_dump \
! 	psql scripts pg_config pg_controldata pg_resetxlog \
!         pg_basebackup pg_ping
  
  ifeq ($(PORTNAME), win32)
  SUBDIRS += pgevent
diff --git a/src/bin/pg_ping/.gitignore b/src/bin/pg_ping/.gitignore
new file mode 100644
index ...9899dd9
*** a/src/bin/pg_ping/.gitignore
--- b/src/bin/pg_ping/.gitignore
***************
*** 0 ****
--- 1 ----
+ /pg_ping
diff --git a/src/bin/pg_ping/Makefile b/src/bin/pg_ping/Makefile
new file mode 100644
index ...6947e85
*** a/src/bin/pg_ping/Makefile
--- b/src/bin/pg_ping/Makefile
***************
*** 0 ****
--- 1,37 ----
+ #-------------------------------------------------------------------------
+ #
+ # Makefile for src/bin/pg_ping
+ #
+ # Copyright (c) 2012, PostgreSQL Global Development Group
+ #
+ # src/bin/pg_ping/Makefile
+ #
+ #-------------------------------------------------------------------------
+ 
+ PGFILEDESC = "pg_ping - checks status of the PostgreSQL server"
+ PGAPPICON=win32
+ 
+ subdir = src/bin/pg_ping
+ top_builddir = ../../..
+ include $(top_builddir)/src/Makefile.global
+ 
+ override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS)
+ 
+ OBJS=	pg_ping.o $(WIN32RES)
+ 
+ all: pg_ping
+ 
+ pg_ping: $(OBJS) | submake-libpq submake-libpgport
+ 	$(CC) $(CFLAGS) $(OBJS) $(libpq_pgport) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X)
+ 
+ install: all installdirs
+ 	$(INSTALL_PROGRAM) pg_ping$(X) '$(DESTDIR)$(bindir)/pg_ping$(X)'
+ 
+ installdirs:
+ 	$(MKDIR_P) '$(DESTDIR)$(bindir)'
+ 
+ uninstall:
+ 	rm -f '$(DESTDIR)$(bindir)/pg_ping$(X)'
+ 
+ clean distclean maintainer-clean:
+ 	rm -f pg_ping$(X) $(OBJS)
diff --git a/src/bin/pg_ping/pg_ping.c b/src/bin/pg_ping/pg_ping.c
new file mode 100644
index ...d356b19
*** a/src/bin/pg_ping/pg_ping.c
--- b/src/bin/pg_ping/pg_ping.c
***************
*** 0 ****
--- 1,165 ----
+ /*-------------------------------------------------------------------------
+  *
+  * pg_ping --- checks the status of the PostgreSQL server
+  *
+  * Copyright (c) 2012, PostgreSQL Global Development Group
+  *
+  * src/bin/pg_ping/pg_ping.c
+  *
+  *-------------------------------------------------------------------------
+  */
+ 
+ #include "postgres_fe.h"
+ #include "libpq-fe.h"
+ #include "getopt_long.h"
+ 
+ void
+ help(const char *progname)
+ {
+     printf(_("%s issues a connection check to a PostgreSQL database.\n\n"), progname);
+     printf(_("Usage:\n"));
+     printf(_("  %s [OPTION]...\n"), progname);
+ 
+     printf(_("\nGeneral options:\n"));
+     printf(_("  -V, --version            output version information, then exit\n"));
+     printf(_("  -v, --verbose            output verbose messages\n"));
+     printf(_("  -?, --help               show this help, then exit\n"));
+ 
+     printf(_("\nConnection options:\n"));
+     printf(_("  -h, --host=HOSTNAME      database server host or socket directory\n"));
+     printf(_("  -p, --port=PORT          database server port \n"));
+     printf(_("  -U, --username=USERNAME  database username\n"));
+ }
+ 
+ int
+ main(int argc, char **argv)
+ {
+     int c,optindex,opt_index = 0;
+ 
+     const char *progname = NULL;
+     const char *pghost = NULL;
+     const char *pgport = NULL;
+     const char *pguser = NULL; 
+ 
+     const char *keywords[4], *values[4];
+ 
+     bool verbose = false;
+ 
+     PGPing rv;
+     PQconninfoOption *connect_options, *conn_opt_ptr;
+ 
+     static struct option long_options[] = {
+             {"host", required_argument, NULL, 'h'},
+             {"port", required_argument, NULL, 'p'},
+             {"username", required_argument, NULL, 'U'},
+             {"version", no_argument, NULL, 'V'},
+             {"verbose", no_argument, NULL, 'v'},
+             {NULL, 0, NULL, 0}
+         };
+ 
+     progname = get_progname(argv[0]);
+ 
+     if ((argc > 1) && (strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-?") == 0))
+     {
+         help(progname);
+         exit(3); // Return UNKNOWN
+     }
+ 
+     while ((c = getopt_long(argc, argv, "h:p:U:vV", long_options, &optindex)) != -1)
+     {
+         switch (c)
+         {
+             case 'h':
+                 pghost = strdup(optarg);
+                 break;
+             case 'p':
+                 pgport = strdup(optarg);
+                 break;
+             case 'U':
+                 pguser = strdup(optarg);
+                 break;
+             case 'v':
+                 verbose = true;
+                 break;
+             case 'V':
+                 puts("pg_ping (PostgreSQL) " PG_VERSION);
+             default:
+                 exit(3); // Return UNKNOWN
+         }
+     }
+ 
+     connect_options = PQconndefaults();
+     conn_opt_ptr = connect_options;
+ 
+     while (NULL != conn_opt_ptr->keyword)
+     {
+         if (strncmp(conn_opt_ptr->keyword, "host", 5) == 0)
+         {
+             if (NULL != pghost)
+             {
+                 keywords[opt_index] = conn_opt_ptr->keyword;
+                 values[opt_index] = pghost;
+                 opt_index++;
+             }
+             else if (NULL != conn_opt_ptr->val)
+                 pghost = conn_opt_ptr->val;
+             else
+                 pghost = DEFAULT_PGSOCKET_DIR;
+         }
+         else if (strncmp(conn_opt_ptr->keyword, "port", 5) == 0)
+         {
+             if (NULL != pgport)
+             {
+                 keywords[opt_index] = conn_opt_ptr->keyword;
+                 values[opt_index] = pgport;
+                 opt_index++;
+             }
+             else if (NULL != conn_opt_ptr->val)
+                 pgport = conn_opt_ptr->val;
+         }
+         else if (strncmp(conn_opt_ptr->keyword, "user", 5) == 0)
+         {
+             if (NULL != pguser)
+             {
+                 keywords[opt_index] = conn_opt_ptr->keyword;
+                 values[opt_index] = pguser;
+                 opt_index++;
+             }
+             else if (NULL != conn_opt_ptr->val)
+                 pguser = conn_opt_ptr->val;
+         }
+         conn_opt_ptr++;
+     }
+ 
+     keywords[opt_index] = NULL;
+     values[opt_index] = NULL;
+ 
+     rv = PQpingParams(keywords, values, 0);
+ 
+     if (verbose)
+     {
+         printf("%s@%s:%s - ", pguser, pghost, pgport);
+ 
+         switch (rv)
+         {
+             case PQPING_OK:
+                 printf("Accepting Conections\n");
+                 break;
+             case PQPING_REJECT:
+                 printf("Rejecting Connections\n");
+                 break;
+             case PQPING_NO_RESPONSE:
+                 printf("No Response\n");
+                 break;
+             case PQPING_NO_ATTEMPT:
+                 printf("No Attempt\n");
+                 break;
+             default:
+                 printf("Unknown\n");
+         }
+     }
+ 
+     PQconninfoFree(connect_options);
+ 
+     exit(rv);
+ }
