#!/bin/bash

# TODO - logging

SERVICES="tomcat-alfresco tomcat-share tomcat-solr"

for SERVICE_NAME in $SERVICES
do
  IS_RUNNING=`service $SERVICE_NAME status | grep 'active (running)'`

  if [ -z "$IS_RUNNING" ]; then
    echo "Restarting service $SERVICE_NAME"
    service $SERVICE_NAME restart
  fi
done
