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