#!/bin/bash set -e running_pgsql=`pgrep -a postgres | grep bin/postgres | awk '{print $2}'` [[ -z $running_pgsql ]] && echo could not determine running_pgsql && exit 1 num_lines=`echo "$running_pgsql" | wc -l` (( num_lines > 1 )) && echo more that one pgsql running && exit 1 unset num_lines echo -n "$host: " $running_pgsql --version