#!/bin/sh sudo service postgresql status &> /dev/null if [ $? -gt 0 ]; then echo '[FAIL] postgresql is not running' exit 1 else echo '[OK] postgresql is running' exit 0 fi