Is alfresco started?

The following shell code checks if Alfresco is started.

#!/bin/bash

### IS Alfresco Started
# Tomcat start port
tomcatPort="8080"
# Alfresco is installed in Linux user account Krishna
userWhereInstalled="Krishna"

# Alfresco Start/Stop status
v2=`netstat -aunt | grep ":::$tomcatPort" | cut -c21-27`
# If tomcat is already stated
if [ "$v2" == ":::$tomcatPort" ] ; then
	userwhostarted=`ps -ef | grep "$userWhereInstalled" | grep java | awk '{print $1}'`
	# and if user is Alfresco, then
	if [ "$userwhostarted" == "$userWhereInstalled" ] ; then 
		echo "Alfresco is started" ; sleep 3 ; exit 0 
	else
		echo "Tomcat is started but not Alfresco" ; sleep 3 ; exit 1 
	fi
else
	echo "Neither Tomcat nor Alfresco is started" ; sleep 3 ; exit 1
fi

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: