You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by di...@apache.org on 2018/03/26 21:15:42 UTC

[airavata] branch develop updated: Creating distribution for job monitors

This is an automated email from the ASF dual-hosted git repository.

dimuthuupe pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/airavata.git


The following commit(s) were added to refs/heads/develop by this push:
     new f25b2a8  Creating distribution for job monitors
f25b2a8 is described below

commit f25b2a8b86a1ad80b61a68d27762ffd80555fb4c
Author: dimuthu <di...@gmail.com>
AuthorDate: Mon Mar 26 17:15:36 2018 -0400

    Creating distribution for job monitors
---
 .../src/main/resources/conf/log4j.properties       |  17 +-
 modules/job-monitor/email-monitor/pom.xml          |   9 +-
 .../src/main/resources/log4j.properties            |  19 +-
 modules/job-monitor/job-monitor-api/pom.xml        |  12 +-
 .../job-monitor/job-monitor-distribution/pom.xml   |  93 +++++++
 .../main/assembly/email-monitor-bin-assembly.xml   | 109 ++++++++
 .../assembly/realtime-monitor-bin-assembly.xml     | 113 +++++++++
 .../email-monitor/bin/email-monitor-daemon.sh      |  91 +++++++
 .../resources/email-monitor/bin/email-monitor.sh   |  71 ++++++
 .../src/main/resources/email-monitor/bin/setenv.sh |  46 ++++
 .../email-monitor/conf/airavata-server.properties  | 278 +++++++++++++++++++++
 .../resources/email-monitor/conf/email-config.yaml |  21 ++
 .../resources/email-monitor}/conf/log4j.properties |  21 +-
 .../bin/realtime-monitor-daemon.sh                 |  91 +++++++
 .../realtime-monitor/bin/realtime-monitor.sh       |  71 ++++++
 .../main/resources/realtime-monitor/bin/setenv.sh  |  46 ++++
 .../conf/airavata-server.properties}               |  20 +-
 .../realtime-monitor}/conf/log4j.properties        |  21 +-
 modules/job-monitor/pom.xml                        |  44 ++--
 modules/job-monitor/real-time-monitor/pom.xml      |   6 +-
 20 files changed, 1126 insertions(+), 73 deletions(-)

diff --git a/modules/airavata-helix-distribution/src/main/resources/conf/log4j.properties b/modules/airavata-helix-distribution/src/main/resources/conf/log4j.properties
index 870e7f0..f1e7445 100644
--- a/modules/airavata-helix-distribution/src/main/resources/conf/log4j.properties
+++ b/modules/airavata-helix-distribution/src/main/resources/conf/log4j.properties
@@ -15,15 +15,20 @@
 # specific language governing permissions and limitations
 # under the License.
 # Set root logger level to DEBUG and its only appender to A1.
-log4j.rootLogger=INFO, A1
+log4j.rootLogger=INFO, CONSOLE, FILE
 
 log4j.category.org.apache.helix=WARN
 log4j.category.org.apache.zookeeper=WARN
 log4j.category.org.apache.airavata.helix.impl.task.submission.config.GroovyMapData=TRACE
 log4j.category.org.apache.airavata.helix.impl.task.submission.JobSubmissionTask=DEBUG
-# A1 is set to be a ConsoleAppender.
-log4j.appender.A1=org.apache.log4j.ConsoleAppender
 
-# A1 uses PatternLayout.
-log4j.appender.A1.layout=org.apache.log4j.PatternLayout
-log4j.appender.A1.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss,SSS} %-4r [%t] %-5p %c %x - %m [E=%X{experiment},P=%X{process},T=%X{task},G=%X{gateway}]%n
\ No newline at end of file
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss,SSS} %-4r [%t] %-5p %c %x - %m [E=%X{experiment},P=%X{process},T=%X{task},G=%X{gateway}]%n
+
+log4j.appender.FILE=org.apache.log4j.RollingFileAppender
+log4j.appender.FILE.File=${airavata.home}/logs/airavata.log
+log4j.appender.FILE.MaxFileSize=100MB
+log4j.appender.FILE.MaxBackupIndex=1
+log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
+log4j.appender.FILE.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss,SSS} %-4r [%t] %-5p %c %x - %m [E=%X{experiment},P=%X{process},T=%X{task},G=%X{gateway}]%n
diff --git a/modules/job-monitor/email-monitor/pom.xml b/modules/job-monitor/email-monitor/pom.xml
index f7b3421..0080207 100644
--- a/modules/job-monitor/email-monitor/pom.xml
+++ b/modules/job-monitor/email-monitor/pom.xml
@@ -1,7 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
 
-
     Licensed to the Apache Software Foundation (ASF) under one
     or more contributor license agreements.  See the NOTICE file
     distributed with this work for additional information
@@ -47,5 +46,13 @@
             <groupId>log4j</groupId>
             <artifactId>log4j</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.yaml</groupId>
+            <artifactId>snakeyaml</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>javax.mail</groupId>
+            <artifactId>mail</artifactId>
+        </dependency>
     </dependencies>
 </project>
\ No newline at end of file
diff --git a/modules/job-monitor/email-monitor/src/main/resources/log4j.properties b/modules/job-monitor/email-monitor/src/main/resources/log4j.properties
index a2c8d83..e927e15 100644
--- a/modules/job-monitor/email-monitor/src/main/resources/log4j.properties
+++ b/modules/job-monitor/email-monitor/src/main/resources/log4j.properties
@@ -15,14 +15,19 @@
 # specific language governing permissions and limitations
 # under the License.
 # Set root logger level to DEBUG and its only appender to A1.
-log4j.rootLogger=INFO, A1
+log4j.rootLogger=INFO, CONSOLE, FILE
 
 log4j.category.org.apache.helix=WARN
-log4j.category.org.apache.kafka=INFO
 log4j.category.org.apache.zookeeper=WARN
-# A1 is set to be a ConsoleAppender.
-log4j.appender.A1=org.apache.log4j.ConsoleAppender
+log4j.category.org.apache.kafka=INFO
+
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss,SSS} %-4r [%t] %-5p %c %x - %m [E=%X{experiment},P=%X{process},T=%X{task},G=%X{gateway}]%n
 
-# A1 uses PatternLayout.
-log4j.appender.A1.layout=org.apache.log4j.PatternLayout
-log4j.appender.A1.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss,SSS} %-4r [%t] %-5p %c %x - %m [E=%X{experiment},P=%X{process},T=%X{task},G=%X{gateway}]%n
\ No newline at end of file
+log4j.appender.FILE=org.apache.log4j.RollingFileAppender
+log4j.appender.FILE.File=${airavata.home}/logs/airavata.log
+log4j.appender.FILE.MaxFileSize=100MB
+log4j.appender.FILE.MaxBackupIndex=1
+log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
+log4j.appender.FILE.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss,SSS} %-4r [%t] %-5p %c %x - %m [E=%X{experiment},P=%X{process},T=%X{task},G=%X{gateway}]%n
\ No newline at end of file
diff --git a/modules/job-monitor/job-monitor-api/pom.xml b/modules/job-monitor/job-monitor-api/pom.xml
index a9031b9..56639cb 100644
--- a/modules/job-monitor/job-monitor-api/pom.xml
+++ b/modules/job-monitor/job-monitor-api/pom.xml
@@ -1,7 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
 
-
     Licensed to the Apache Software Foundation (ASF) under one
     or more contributor license agreements.  See the NOTICE file
     distributed with this work for additional information
@@ -32,4 +31,15 @@
 
     <artifactId>job-monitor-api</artifactId>
 
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>airavata-commons</artifactId>
+            <version>0.17-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.kafka</groupId>
+            <artifactId>kafka-clients</artifactId>
+        </dependency>
+    </dependencies>
 </project>
\ No newline at end of file
diff --git a/modules/job-monitor/job-monitor-distribution/pom.xml b/modules/job-monitor/job-monitor-distribution/pom.xml
new file mode 100644
index 0000000..c4ce2bd
--- /dev/null
+++ b/modules/job-monitor/job-monitor-distribution/pom.xml
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>job-monitor</artifactId>
+        <groupId>org.apache.airavata</groupId>
+        <version>0.17-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>job-monitor-distribution</artifactId>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>email-monitor</artifactId>
+            <version>0.17-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>realtime-monitor</artifactId>
+            <version>0.17-SNAPSHOT</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-assembly-plugin</artifactId>
+                <version>2.5.5</version>
+                <executions>
+                    <execution>
+                        <id>email-monitor-distribution-package</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>single</goal>
+                        </goals>
+                        <configuration>
+                            <tarLongFileMode>posix</tarLongFileMode>
+                            <finalName>${email.monitor.archieve.name}-${project.version}</finalName>
+                            <descriptors>
+                                <descriptor>src/main/assembly/email-monitor-bin-assembly.xml</descriptor>
+                            </descriptors>
+                            <attach>false</attach>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>realtime-monitor-distribution-package</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>single</goal>
+                        </goals>
+                        <configuration>
+                            <tarLongFileMode>posix</tarLongFileMode>
+                            <finalName>${realtime.monitor.archieve.name}-${project.version}</finalName>
+                            <descriptors>
+                                <descriptor>src/main/assembly/realtime-monitor-bin-assembly.xml</descriptor>
+                            </descriptors>
+                            <attach>false</attach>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
+    <properties>
+        <email.monitor.archieve.name>email-monitor</email.monitor.archieve.name>
+        <realtime.monitor.archieve.name>realtime-monitor</realtime.monitor.archieve.name>
+    </properties>
+</project>
\ No newline at end of file
diff --git a/modules/job-monitor/job-monitor-distribution/src/main/assembly/email-monitor-bin-assembly.xml b/modules/job-monitor/job-monitor-distribution/src/main/assembly/email-monitor-bin-assembly.xml
new file mode 100644
index 0000000..53c8409
--- /dev/null
+++ b/modules/job-monitor/job-monitor-distribution/src/main/assembly/email-monitor-bin-assembly.xml
@@ -0,0 +1,109 @@
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+<!DOCTYPE assembly [
+        <!ELEMENT assembly (id|includeBaseDirectory|baseDirectory|formats|fileSets|dependencySets)*>
+        <!ELEMENT id (#PCDATA)>
+        <!ELEMENT includeBaseDirectory (#PCDATA)>
+        <!ELEMENT baseDirectory (#PCDATA)>
+        <!ELEMENT formats (format)*>
+        <!ELEMENT format (#PCDATA)>
+        <!ELEMENT fileSets (fileSet)*>
+        <!ELEMENT fileSet (directory|outputDirectory|fileMode|includes)*>
+        <!ELEMENT directory (#PCDATA)>
+        <!ELEMENT outputDirectory (#PCDATA)>
+        <!ELEMENT includes (include)*>
+        <!ELEMENT include (#PCDATA)>
+        <!ELEMENT dependencySets (dependencySet)*>
+        <!ELEMENT dependencySet (outputDirectory|outputFileNameMapping|includes)*>
+        ]>
+<assembly>
+    <id>bin</id>
+    <includeBaseDirectory>true</includeBaseDirectory>
+    <baseDirectory>${email.monitor.archieve.name}-${version}</baseDirectory>
+    <formats>
+        <format>tar.gz</format>
+        <format>zip</format>
+    </formats>
+
+    <fileSets>
+
+        <fileSet>
+            <directory>src/main/resources/email-monitor/bin</directory>
+            <outputDirectory>bin</outputDirectory>
+            <fileMode>777</fileMode>
+            <includes>
+                <include>*.sh</include>
+            </includes>
+        </fileSet>
+        <fileSet>
+            <directory>src/main/resources/email-monitor/conf</directory>
+            <outputDirectory>conf</outputDirectory>
+            <fileMode>777</fileMode>
+            <includes>
+                <include>airavata-server.properties</include>
+                <include>email-config.yaml</include>
+                <include>log4j.properties</include>
+            </includes>
+        </fileSet>
+
+        <!-- Create logs directory -->
+        <fileSet>
+            <directory>./</directory>
+            <outputDirectory>logs</outputDirectory>
+            <excludes>
+                <exclude>*/**</exclude>
+            </excludes>
+        </fileSet>
+
+    </fileSets>
+
+    <dependencySets>
+
+        <dependencySet>
+            <useProjectArtifact>false</useProjectArtifact>
+            <outputDirectory>lib</outputDirectory>
+            <includes>
+                <include>org.apache.airavata:email-monitor:jar</include>
+                <include>org.apache.airavata:job-monitor-api:jar</include>
+
+                <include>org.apache.airavata:airavata-commons:jar</include>
+                <include>commons-cli:commons-cli</include>
+                <include>org.apache.airavata:airavata-data-models:jar</include>
+                <include>org.apache.thrift:libthrift:jar</include>
+
+                <include>javax.mail:mail:jar</include>
+                <include>javax.activation:activation:jar</include>
+                <include>org.yaml:snakeyaml:jar</include>
+
+                <!-- kafka specific jars -->
+                <include>org.apache.kafka:kafka-clients:jar</include>
+                <include>org.lz4:lz4-java:jar</include>
+                <include>org.xerial.snappy:snappy-java:jar</include>
+
+                <!-- logging jars -->
+                <include>org.slf4j:slf4j-api:jar</include>
+                <include>org.slf4j:slf4j-log4j12:jar</include>
+                <include>log4j:log4j:jar</include>
+
+            </includes>
+        </dependencySet>
+    </dependencySets>
+
+</assembly>
diff --git a/modules/job-monitor/job-monitor-distribution/src/main/assembly/realtime-monitor-bin-assembly.xml b/modules/job-monitor/job-monitor-distribution/src/main/assembly/realtime-monitor-bin-assembly.xml
new file mode 100644
index 0000000..354fa2f
--- /dev/null
+++ b/modules/job-monitor/job-monitor-distribution/src/main/assembly/realtime-monitor-bin-assembly.xml
@@ -0,0 +1,113 @@
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+<!DOCTYPE assembly [
+        <!ELEMENT assembly (id|includeBaseDirectory|baseDirectory|formats|fileSets|dependencySets)*>
+        <!ELEMENT id (#PCDATA)>
+        <!ELEMENT includeBaseDirectory (#PCDATA)>
+        <!ELEMENT baseDirectory (#PCDATA)>
+        <!ELEMENT formats (format)*>
+        <!ELEMENT format (#PCDATA)>
+        <!ELEMENT fileSets (fileSet)*>
+        <!ELEMENT fileSet (directory|outputDirectory|fileMode|includes)*>
+        <!ELEMENT directory (#PCDATA)>
+        <!ELEMENT outputDirectory (#PCDATA)>
+        <!ELEMENT includes (include)*>
+        <!ELEMENT include (#PCDATA)>
+        <!ELEMENT dependencySets (dependencySet)*>
+        <!ELEMENT dependencySet (outputDirectory|outputFileNameMapping|includes)*>
+        ]>
+<assembly>
+    <id>bin</id>
+    <includeBaseDirectory>true</includeBaseDirectory>
+    <baseDirectory>${realtime.monitor.archieve.name}-${version}</baseDirectory>
+    <formats>
+        <format>tar.gz</format>
+        <format>zip</format>
+    </formats>
+
+    <fileSets>
+
+        <fileSet>
+            <directory>src/main/resources/realtime-monitor/bin</directory>
+            <outputDirectory>bin</outputDirectory>
+            <fileMode>777</fileMode>
+            <includes>
+                <include>*.sh</include>
+            </includes>
+        </fileSet>
+        <fileSet>
+            <directory>src/main/resources/realtime-monitor/conf</directory>
+            <outputDirectory>conf</outputDirectory>
+            <fileMode>777</fileMode>
+            <includes>
+                <include>airavata-server.properties</include>
+                <include>log4j.properties</include>
+            </includes>
+        </fileSet>
+
+        <!-- Create logs directory -->
+        <fileSet>
+            <directory>./</directory>
+            <outputDirectory>logs</outputDirectory>
+            <excludes>
+                <exclude>*/**</exclude>
+            </excludes>
+        </fileSet>
+
+    </fileSets>
+
+    <dependencySets>
+
+        <dependencySet>
+            <useProjectArtifact>false</useProjectArtifact>
+            <outputDirectory>lib</outputDirectory>
+            <includes>
+                <include>org.apache.airavata:realtime-monitor:jar</include>
+                <include>org.apache.airavata:job-monitor-api:jar</include>
+
+                <include>org.apache.airavata:airavata-commons:jar</include>
+                <include>commons-cli:commons-cli</include>
+
+
+                <!-- kafka specific jars -->
+                <include>org.apache.kafka:kafka-clients:jar</include>
+                <include>org.lz4:lz4-java:jar</include>
+                <include>org.xerial.snappy:snappy-java:jar</include>
+
+                <!-- curator and zookeeper jars -->
+                <include>org.apache.curator:curator-framework:jar</include>
+                <include>org.apache.curator:curator-client:jar</include>
+                <include>com.google.guava:guava:jar</include>
+                <include>org.apache.zookeeper:zookeeper:jar</include>
+                <include>jline:jline:jar</include>
+                <include>org.jboss.netty:netty:jar</include>
+
+                <include>com.google.code.gson:gson:jar</include>
+
+                <!-- logging jars -->
+                <include>org.slf4j:slf4j-api:jar</include>
+                <include>org.slf4j:slf4j-log4j12:jar</include>
+                <include>log4j:log4j:jar</include>
+
+            </includes>
+        </dependencySet>
+    </dependencySets>
+
+</assembly>
diff --git a/modules/job-monitor/job-monitor-distribution/src/main/resources/email-monitor/bin/email-monitor-daemon.sh b/modules/job-monitor/job-monitor-distribution/src/main/resources/email-monitor/bin/email-monitor-daemon.sh
new file mode 100644
index 0000000..05b80c3
--- /dev/null
+++ b/modules/job-monitor/job-monitor-distribution/src/main/resources/email-monitor/bin/email-monitor-daemon.sh
@@ -0,0 +1,91 @@
+#!/usr/bin/env bash
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+. `dirname $0`/setenv.sh
+# Capture user's working dir before changing directory
+CWD="$PWD"
+cd ${AIRAVATA_HOME}/bin
+LOGO_FILE="logo.txt"
+
+JAVA_OPTS="-Dairavata.config.dir=${AIRAVATA_HOME}/conf -Dairavata.home=${AIRAVATA_HOME} -Dlog4j.configuration=file:${AIRAVATA_HOME}/conf/log4j.properties"
+AIRAVATA_COMMAND=""
+EXTRA_ARGS=""
+SERVERS=""
+LOGO=true
+IS_SUBSET=false
+SUBSET=""
+DEFAULT_LOG_FILE="${AIRAVATA_HOME}/logs/airavata-daemon.out"
+LOG_FILE=$DEFAULT_LOG_FILE
+
+SERVICE_NAME="Email Monitor"
+PID_PATH_NAME="${AIRAVATA_HOME}/bin/service-pid"
+
+case $1 in
+    start)
+        echo "Starting $SERVICE_NAME ..."
+        if [ ! -f $PID_PATH_NAME ]; then
+            nohup java ${JAVA_OPTS} -classpath "${AIRAVATA_CLASSPATH}" \
+            org.apache.airavata.monitor.email.EmailBasedMonitor ${AIRAVATA_COMMAND} $* > $LOG_FILE 2>&1 &
+            echo $! > $PID_PATH_NAME
+            echo "$SERVICE_NAME started ..."
+        else
+            echo "$SERVICE_NAME is already running ..."
+        fi
+    ;;
+    stop)
+        if [ -f $PID_PATH_NAME ]; then
+            PID=$(cat $PID_PATH_NAME);
+            echo "$SERVICE_NAME stoping ..."
+            kill $PID;
+            echo "$SERVICE_NAME stopped ..."
+            rm $PID_PATH_NAME
+        else
+            echo "$SERVICE_NAME is not running ..."
+        fi
+    ;;
+    restart)
+        if [ -f $PID_PATH_NAME ]; then
+            PID=$(cat $PID_PATH_NAME);
+            echo "$SERVICE_NAME stopping ...";
+            kill $PID;
+            echo "$SERVICE_NAME stopped ...";
+            rm $PID_PATH_NAME
+            echo "$SERVICE_NAME starting ..."
+            nohup java ${JAVA_OPTS} -classpath "${AIRAVATA_CLASSPATH}" \
+            org.apache.airavata.monitor.email.EmailBasedMonitor ${AIRAVATA_COMMAND} $* > $LOG_FILE 2>&1 &
+            echo $! > $PID_PATH_NAME
+            echo "$SERVICE_NAME started ..."
+        else
+            echo "$SERVICE_NAME is not running ..."
+        fi
+    ;;
+    -h)
+        echo "Usage: email-monitor-daemon.sh"
+
+        echo "command options:"
+        echo "  start               Start server in daemon mode"
+        echo "  stop                Stop server running in daemon mode"
+        echo "  restart             Restart server in daemon mode"
+	    echo "  -log <LOG_FILE>     Where to redirect stdout/stderr (defaults to $DEFAULT_LOG_FILE)"
+        echo "  -h                  Display this help and exit"
+        shift
+        exit 0
+    ;;
+esac
+
diff --git a/modules/job-monitor/job-monitor-distribution/src/main/resources/email-monitor/bin/email-monitor.sh b/modules/job-monitor/job-monitor-distribution/src/main/resources/email-monitor/bin/email-monitor.sh
new file mode 100644
index 0000000..bf29487
--- /dev/null
+++ b/modules/job-monitor/job-monitor-distribution/src/main/resources/email-monitor/bin/email-monitor.sh
@@ -0,0 +1,71 @@
+#!/usr/bin/env bash
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+. `dirname $0`/setenv.sh
+# Capture user's working dir before changing directory
+CWD="$PWD"
+cd ${AIRAVATA_HOME}/bin
+LOGO_FILE="logo.txt"
+
+JAVA_OPTS="-Dairavata.config.dir=${AIRAVATA_HOME}/conf -Dairavata.home=${AIRAVATA_HOME} -Dlog4j.configuration=file:${AIRAVATA_HOME}/conf/log4j.properties"
+AIRAVATA_COMMAND=""
+EXTRA_ARGS=""
+SERVERS=""
+IS_SUBSET=false
+SUBSET=""
+DEFAULT_LOG_FILE="${AIRAVATA_HOME}/logs/airavata.out"
+LOG_FILE=$DEFAULT_LOG_FILE
+
+# parse command arguments
+for var in "$@"
+do
+    case ${var} in
+        -xdebug)
+        	AIRAVATA_COMMAND="${AIRAVATA_COMMAND}"
+            JAVA_OPTS="$JAVA_OPTS -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,address=8000"
+            shift
+	    ;;
+        -log)
+            shift
+            LOG_FILE="$1"
+            shift
+            # If relative path, expand to absolute path using the user's $CWD
+            if [ -z "`echo "$LOG_FILE" | egrep "^/"`" ]; then
+                LOG_FILE="${CWD}/${LOG_FILE}"
+            fi
+        ;;
+        -h)
+            echo "Usage: email-monitor.sh"
+
+            echo "command options:"
+            echo "  -xdebug             Start Email Monitor under JPDA debugger"
+            echo "  -h                  Display this help and exit"
+            shift
+            exit 0
+        ;;
+	    *)
+	        EXTRA_ARGS="${EXTRA_ARGS} ${var}"
+            shift
+        ;;
+    esac
+done
+
+java ${JAVA_OPTS} -classpath "${AIRAVATA_CLASSPATH}" \
+    org.apache.airavata.monitor.email.EmailBasedMonitor ${AIRAVATA_COMMAND} $*
+
diff --git a/modules/job-monitor/job-monitor-distribution/src/main/resources/email-monitor/bin/setenv.sh b/modules/job-monitor/job-monitor-distribution/src/main/resources/email-monitor/bin/setenv.sh
new file mode 100755
index 0000000..9e894e1
--- /dev/null
+++ b/modules/job-monitor/job-monitor-distribution/src/main/resources/email-monitor/bin/setenv.sh
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+# 
+# http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# resolve links - $0 may be a softlink
+PRG="$0"
+
+while [ -h "$PRG" ]; do
+  ls=`ls -ld "$PRG"`
+  link=`expr "$ls" : '.*-> \(.*\)$'`
+  if expr "$link" : '.*/.*' > /dev/null; then
+    PRG="$link"
+  else
+    PRG=`dirname "$PRG"`/"$link"
+  fi
+done
+
+PRGDIR=`dirname "$PRG"`
+
+# Only set AIRAVATA_HOME if not already set
+[ -z "$AIRAVATA_HOME" ] && AIRAVATA_HOME=`cd "$PRGDIR/.." ; pwd`
+
+AIRAVATA_CLASSPATH=""
+
+for f in "$AIRAVATA_HOME"/lib/*.jar
+do
+  AIRAVATA_CLASSPATH="$AIRAVATA_CLASSPATH":$f
+done
+
+export AIRAVATA_HOME
+export AIRAVATA_CLASSPATH
diff --git a/modules/job-monitor/job-monitor-distribution/src/main/resources/email-monitor/conf/airavata-server.properties b/modules/job-monitor/job-monitor-distribution/src/main/resources/email-monitor/conf/airavata-server.properties
new file mode 100644
index 0000000..fb22e75
--- /dev/null
+++ b/modules/job-monitor/job-monitor-distribution/src/main/resources/email-monitor/conf/airavata-server.properties
@@ -0,0 +1,278 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+###########################################################################
+#
+#  This properties file provides configuration for all Airavata Services:
+#  API Server, Registry, Workflow Interpreter, GFac, Orchestrator
+#
+###########################################################################
+
+###########################################################################
+#  API Server Registry Configuration
+###########################################################################
+
+#for derby [AiravataJPARegistry]
+#registry.jdbc.driver=org.apache.derby.jdbc.ClientDriver
+#registry.jdbc.url=jdbc:derby://localhost:1527/experiment_catalog;create=true;user=airavata;password=airavata
+# MariaDB database configuration
+registry.jdbc.driver=org.mariadb.jdbc.Driver
+registry.jdbc.url=jdbc:mariadb://192.168.99.103:3306/experiment_catalog
+registry.jdbc.user=airavata
+registry.jdbc.password=123456
+#FIXME: Probably the following property should be removed.
+start.derby.server.mode=false
+validationQuery=SELECT 1 from CONFIGURATION
+cache.enable=false
+jpa.cache.size=-1
+#jpa.connection.properties=MaxActive=10,MaxIdle=5,MinIdle=2,MaxWait=60000,testWhileIdle=true,testOnBorrow=true
+enable.sharing=true
+
+# Properties for default user mode
+default.registry.user=default-admin
+default.registry.password=123456
+default.registry.password.hash.method=SHA
+default.registry.gateway=default
+super.tenant.gatewayId=default
+
+###########################################################################
+#  Application Catalog DB Configuration
+###########################################################################
+#for derby [AiravataJPARegistry]
+#appcatalog.jdbc.driver=org.apache.derby.jdbc.ClientDriver
+#appcatalog.jdbc.url=jdbc:derby://localhost:1527/app_catalog;create=true;user=airavata;password=airavata
+# MariaDB database configuration
+appcatalog.jdbc.driver=org.mariadb.jdbc.Driver
+appcatalog.jdbc.url=jdbc:mariadb://192.168.99.103:3306/app_catalog
+appcatalog.jdbc.user=airavata
+appcatalog.jdbc.password=123456
+appcatalog.validationQuery=SELECT 1 from CONFIGURATION
+
+##########################################################################
+#  Replica Catalog DB Configuration
+###########################################################################
+#for derby [AiravataJPARegistry]
+#replicacatalog.jdbc.driver=org.apache.derby.jdbc.ClientDriver
+#replicacatalog.jdbc.url=jdbc:derby://localhost:1527/replica_catalog;create=true;user=airavata;password=airavata
+# MariaDB database configuration
+replicacatalog.jdbc.driver=org.mariadb.jdbc.Driver
+replicacatalog.jdbc.url=jdbc:mariadb://192.168.99.103:3306/replica_catalog
+replicacatalog.jdbc.user=airavata
+replicacatalog.jdbc.password=123456
+replicacatalog.validationQuery=SELECT 1 from CONFIGURATION
+
+###########################################################################
+#  Sharing Catalog DB Configuration
+###########################################################################
+#for derby [AiravataJPARegistry]
+#sharingcatalog.jdbc.driver=org.apache.derby.jdbc.ClientDriver
+#sharingcatalog.jdbc.url=jdbc:derby://localhost:1527/sharing_catalog;create=true;user=airavata;password=airavata
+# MariaDB database configuration
+sharingcatalog.jdbc.driver=org.mariadb.jdbc.Driver
+sharingcatalog.jdbc.url=jdbc:mariadb://192.168.99.103:3306/sharing_catalog
+sharingcatalog.jdbc.user=airavata
+sharingcatalog.jdbc.password=123456
+sharingcatalog.validationQuery=SELECT 1 from CONFIGURATION
+
+###########################################################################
+#  Sharing Registry Server Configuration
+###########################################################################
+sharing_server=org.apache.airavata.sharing.registry.server.SharingRegistryServer
+sharing.registry.server.host=192.168.99.102
+sharing.registry.server.port=7878
+
+###########################################################################
+#  API Server Configurations
+###########################################################################
+apiserver=org.apache.airavata.api.server.AiravataAPIServer
+apiserver.name=apiserver-node0
+apiserver.host=192.168.99.102
+apiserver.port=8930
+apiserver.min.threads=50
+
+###########################################################################
+#  Registry Server Configurations
+###########################################################################
+regserver=org.apache.airavata.registry.api.service.RegistryAPIServer
+regserver.server.name=regserver-node0
+regserver.server.host=192.168.99.102
+regserver.server.port=8970
+regserver.server.min.threads=50
+
+
+###########################################################################
+#  Job Scheduler can send informative email messages to you about the status of your job.
+# Specify a string which consists of either the single character "n" (no mail), or one or more
+#  of the characters "a" (send mail when job is aborted), "b" (send mail when job begins),
+# and "e" (send mail when job terminates).  The default is "a" if not specified.
+###########################################################################
+
+job.notification.enable=true
+#Provide comma separated email ids as a string if more than one
+job.notification.emailids=
+job.notification.flags=abe
+
+###########################################################################
+# Credential Store module Configuration
+###########################################################################
+credential.store.keystore.url=/Users/dimuthu/code/reference/airavata/modules/airavata-helix-distribution/src/main/resources/conf/cred_store.jks
+credential.store.keystore.alias=seckey
+credential.store.keystore.password=credstore123
+credential.store.jdbc.url=jdbc:mariadb://192.168.99.103:3306/credential_store
+credential.store.jdbc.user=airavata
+credential.store.jdbc.password=123456
+credential.store.jdbc.driver=org.mariadb.jdbc.Driver
+credential.store.server.host=192.168.99.102
+credential.store.server.port=8960
+credentialstore=org.apache.airavata.credential.store.server.CredentialStoreServer
+credential.stroe.jdbc.validationQuery=SELECT 1 from CONFIGURATION
+
+# these properties used by credential store email notifications
+email.server=smtp.googlemail.com
+email.server.port=465
+email.user=airavata
+email.password=xxx
+email.ssl=true
+email.from=airavata@apache.org
+
+# SSH PKI key pair or ssh password can be used SSH based sshKeyAuthentication is used.
+# if user specify both password sshKeyAuthentication gets the higher preference
+
+################# ---------- For ssh key pair sshKeyAuthentication ------------------- ################
+#ssh.public.key=/path to public key for ssh
+#ssh.private.key=/path to private key file for ssh
+#ssh.keypass=passphrase for the private key
+#ssh.username=username for ssh connection
+## If you set "yes" for ssh.strict.hostKey.checking, then you must provide known hosts file path
+#ssh.strict.hostKey.checking=yes/no
+#ssh.known.hosts.file=/path to known hosts file
+### Incase of password sshKeyAuthentication.
+#ssh.password=Password for ssh connection
+
+################ ---------- BES Properties ------------------- ###############
+#bes.ca.cert.path=<location>/certificates/cacert.pem
+#bes.ca.key.path=<location>/certificates/cakey.pem
+#bes.ca.key.pass=passphrase
+
+###########################################################################
+# Monitoring module Configuration
+###########################################################################
+
+#This will be the primary monitoring tool which runs in airavata, in future there will be multiple monitoring
+#mechanisms and one would be able to start a monitor
+monitors=org.apache.airavata.gfac.monitor.impl.pull.qstat.QstatMonitor,org.apache.airavata.gfac.monitor.impl.LocalJobMonitor
+
+#These properties will used to enable email base monitoring
+email.based.monitor.host=imap.gmail.com
+email.based.monitor.address=CHANGEME
+email.based.monitor.password=CHANGEME
+email.based.monitor.folder.name=INBOX
+# either imaps or pop3
+email.based.monitor.store.protocol=imaps
+#These property will be used to query the email server periodically. value in milliseconds(ms).
+email.based.monitoring.period=10000
+job.monitor.broker.url=192.168.99.103:9092
+job.monitor.broker.topic=parsed-data
+job.monitor.broker.publisher.id=EmailBasedProducer
+
+###########################################################################
+#Helix workflow manager configurations
+###########################################################################
+
+kafka.broker.url=192.168.99.103:9092
+kafka.broker.topic=parsed-data
+kafka.broker.consumer.group=MonitoringConsumer
+helix.cluster.name=AiravataDemoCluster
+pre.workflow.manager.name=prewm
+post.workflow.manager.name=postwm
+helix.controller.name=helixcontroller
+helix.participant.name=helixparticipant
+
+###########################################################################
+# AMQP Notification Configuration
+###########################################################################
+#for simple scenarios we can use the guest user
+#rabbitmq.broker.url=amqp://localhost:5672
+#for production scenarios, give url as amqp://userName:password@hostName:portNumber/virtualHost, create user, virtualhost
+# and give permissions, refer: http://blog.dtzq.com/2012/06/rabbitmq-users-and-virtual-hosts.html
+rabbitmq.broker.url=amqp://airavata:123456@192.168.99.103:5672/master
+rabbitmq.status.exchange.name=status_exchange
+rabbitmq.process.exchange.name=process_exchange
+rabbitmq.experiment.exchange.name=experiment_exchange
+durable.queue=false
+prefetch.count=200
+process.launch.queue.name=process.launch.queue
+experiment.launch..queue.name=experiment.launch.queue
+
+###########################################################################
+# Zookeeper Server Configuration
+###########################################################################
+embedded.zk=false
+zookeeper.server.connection=192.168.99.103:2181
+zookeeper.timeout=30000
+
+########################################################################
+## API Security Configuration
+########################################################################
+api.secured=false
+security.manager.class=org.apache.airavata.service.security.KeyCloakSecurityManager
+### TLS related configuration ####
+TLS.enabled=true
+TLS.api.server.port=9930
+TLS.client.timeout=10000
+#### keystore configuration ####
+keystore.path=/home/pga/master-deployment/keystores/airavata.jks
+keystore.password=password
+#### trust store configuration ####
+trust.store=/home/pga/master-deployment/keystores/client_truststore.jks
+trust.store.password=password
+#### authorization cache related configuration ####
+authz.cache.enabled=true
+authz.cache.manager.class=org.apache.airavata.service.security.authzcache.DefaultAuthzCacheManager
+in.memory.cache.size=1000
+
+# Kafka Logging related configuration
+isRunningOnAws=false
+kafka.broker.list=192.168.99.103:9092
+kafka.topic.prefix=local
+enable.kafka.logging=false
+
+###########################################################################
+# Profile Service Configuration
+###########################################################################
+profile.service.server.host=192.168.99.102
+profile.service.server.port=8962
+profile_service=org.apache.airavata.service.profile.server.ProfileServiceServer
+# MariaDB properties
+profile.service.jdbc.url=jdbc:mariadb://192.168.99.103:3306/profile_service
+profile.service.jdbc.user=airavata
+profile.service.jdbc.password=123456
+profile.service.jdbc.driver=org.mariadb.jdbc.Driver
+profile.service.validationQuery=SELECT 1
+
+###########################################################################
+# Iam Admin services Configuration
+###########################################################################
+iam.server.url=https://192.168.99.103/auth
+iam.server.super.admin.username=admin
+iam.server.super.admin.password=123456
+
+###########################################################################
+# DB Event Manager Runner
+###########################################################################
+db_event_manager=org.apache.airavata.db.event.manager.DBEventManagerRunner
diff --git a/modules/job-monitor/job-monitor-distribution/src/main/resources/email-monitor/conf/email-config.yaml b/modules/job-monitor/job-monitor-distribution/src/main/resources/email-monitor/conf/email-config.yaml
new file mode 100644
index 0000000..4c8f147
--- /dev/null
+++ b/modules/job-monitor/job-monitor-distribution/src/main/resources/email-monitor/conf/email-config.yaml
@@ -0,0 +1,21 @@
+config:
+ resources:
+   - jobManagerType: PBS
+     emailParser: org.apache.airavata.monitor.email.parser.PBSEmailParser
+     resourceEmailAddresses:
+       - pbsconsult@sdsc.edu  # gordon
+       - adm@trident.bigred2.uits.iu.edu # Bigred2
+       - root <ad...@trident.bigred2.uits.iu.edu> # Bigred2
+       - root <ad...@scyld.localdomain> # alamo
+
+   - jobManagerType: SLURM
+     emailParser: org.apache.airavata.monitor.email.parser.SLURMEmailParser
+     resourceEmailAddresses:
+       - SDSC Admin <sl...@comet-fe3.sdsc.edu> # comet
+       - slurm@batch1.stampede.tacc.utexas.edu # stampede
+       - slurm@helix-slurm-headnode.novalocal
+
+   - jobManagerType: UGE
+     emailParser: org.apache.airavata.monitor.email.parser.UGEEmailParser
+     resourceEmailAddresses:
+       - ls4.tacc.utexas.edu # contain Lonestar
\ No newline at end of file
diff --git a/modules/airavata-helix-distribution/src/main/resources/conf/log4j.properties b/modules/job-monitor/job-monitor-distribution/src/main/resources/email-monitor/conf/log4j.properties
similarity index 54%
copy from modules/airavata-helix-distribution/src/main/resources/conf/log4j.properties
copy to modules/job-monitor/job-monitor-distribution/src/main/resources/email-monitor/conf/log4j.properties
index 870e7f0..7f9631c 100644
--- a/modules/airavata-helix-distribution/src/main/resources/conf/log4j.properties
+++ b/modules/job-monitor/job-monitor-distribution/src/main/resources/email-monitor/conf/log4j.properties
@@ -14,16 +14,19 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-# Set root logger level to DEBUG and its only appender to A1.
-log4j.rootLogger=INFO, A1
+
+log4j.rootLogger=INFO, CONSOLE, FILE
 
 log4j.category.org.apache.helix=WARN
 log4j.category.org.apache.zookeeper=WARN
-log4j.category.org.apache.airavata.helix.impl.task.submission.config.GroovyMapData=TRACE
-log4j.category.org.apache.airavata.helix.impl.task.submission.JobSubmissionTask=DEBUG
-# A1 is set to be a ConsoleAppender.
-log4j.appender.A1=org.apache.log4j.ConsoleAppender
 
-# A1 uses PatternLayout.
-log4j.appender.A1.layout=org.apache.log4j.PatternLayout
-log4j.appender.A1.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss,SSS} %-4r [%t] %-5p %c %x - %m [E=%X{experiment},P=%X{process},T=%X{task},G=%X{gateway}]%n
\ No newline at end of file
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss,SSS} %-4r [%t] %-5p %c %x - %m [E=%X{experiment},P=%X{process},T=%X{task},G=%X{gateway}]%n
+
+log4j.appender.FILE=org.apache.log4j.RollingFileAppender
+log4j.appender.FILE.File=${airavata.home}/logs/airavata.log
+log4j.appender.FILE.MaxFileSize=100MB
+log4j.appender.FILE.MaxBackupIndex=1
+log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
+log4j.appender.FILE.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss,SSS} %-4r [%t] %-5p %c %x - %m [E=%X{experiment},P=%X{process},T=%X{task},G=%X{gateway}]%n
\ No newline at end of file
diff --git a/modules/job-monitor/job-monitor-distribution/src/main/resources/realtime-monitor/bin/realtime-monitor-daemon.sh b/modules/job-monitor/job-monitor-distribution/src/main/resources/realtime-monitor/bin/realtime-monitor-daemon.sh
new file mode 100644
index 0000000..7faf356
--- /dev/null
+++ b/modules/job-monitor/job-monitor-distribution/src/main/resources/realtime-monitor/bin/realtime-monitor-daemon.sh
@@ -0,0 +1,91 @@
+#!/usr/bin/env bash
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+. `dirname $0`/setenv.sh
+# Capture user's working dir before changing directory
+CWD="$PWD"
+cd ${AIRAVATA_HOME}/bin
+LOGO_FILE="logo.txt"
+
+JAVA_OPTS="-Dairavata.config.dir=${AIRAVATA_HOME}/conf -Dairavata.home=${AIRAVATA_HOME} -Dlog4j.configuration=file:${AIRAVATA_HOME}/conf/log4j.properties"
+AIRAVATA_COMMAND=""
+EXTRA_ARGS=""
+SERVERS=""
+LOGO=true
+IS_SUBSET=false
+SUBSET=""
+DEFAULT_LOG_FILE="${AIRAVATA_HOME}/logs/airavata-daemon.out"
+LOG_FILE=$DEFAULT_LOG_FILE
+
+SERVICE_NAME="Realtime Monitor"
+PID_PATH_NAME="${AIRAVATA_HOME}/bin/service-pid"
+
+case $1 in
+    start)
+        echo "Starting $SERVICE_NAME ..."
+        if [ ! -f $PID_PATH_NAME ]; then
+            nohup java ${JAVA_OPTS} -classpath "${AIRAVATA_CLASSPATH}" \
+            org.apache.airavata.monitor.realtime.RealtimeMonitor ${AIRAVATA_COMMAND} $* > $LOG_FILE 2>&1 &
+            echo $! > $PID_PATH_NAME
+            echo "$SERVICE_NAME started ..."
+        else
+            echo "$SERVICE_NAME is already running ..."
+        fi
+    ;;
+    stop)
+        if [ -f $PID_PATH_NAME ]; then
+            PID=$(cat $PID_PATH_NAME);
+            echo "$SERVICE_NAME stoping ..."
+            kill $PID;
+            echo "$SERVICE_NAME stopped ..."
+            rm $PID_PATH_NAME
+        else
+            echo "$SERVICE_NAME is not running ..."
+        fi
+    ;;
+    restart)
+        if [ -f $PID_PATH_NAME ]; then
+            PID=$(cat $PID_PATH_NAME);
+            echo "$SERVICE_NAME stopping ...";
+            kill $PID;
+            echo "$SERVICE_NAME stopped ...";
+            rm $PID_PATH_NAME
+            echo "$SERVICE_NAME starting ..."
+            nohup java ${JAVA_OPTS} -classpath "${AIRAVATA_CLASSPATH}" \
+            org.apache.airavata.monitor.realtime.RealtimeMonitor ${AIRAVATA_COMMAND} $* > $LOG_FILE 2>&1 &
+            echo $! > $PID_PATH_NAME
+            echo "$SERVICE_NAME started ..."
+        else
+            echo "$SERVICE_NAME is not running ..."
+        fi
+    ;;
+    -h)
+        echo "Usage: realtime-monitor-daemon.sh"
+
+        echo "command options:"
+        echo "  start               Start server in daemon mode"
+        echo "  stop                Stop server running in daemon mode"
+        echo "  restart             Restart server in daemon mode"
+	    echo "  -log <LOG_FILE>     Where to redirect stdout/stderr (defaults to $DEFAULT_LOG_FILE)"
+        echo "  -h                  Display this help and exit"
+        shift
+        exit 0
+    ;;
+esac
+
diff --git a/modules/job-monitor/job-monitor-distribution/src/main/resources/realtime-monitor/bin/realtime-monitor.sh b/modules/job-monitor/job-monitor-distribution/src/main/resources/realtime-monitor/bin/realtime-monitor.sh
new file mode 100644
index 0000000..9838636
--- /dev/null
+++ b/modules/job-monitor/job-monitor-distribution/src/main/resources/realtime-monitor/bin/realtime-monitor.sh
@@ -0,0 +1,71 @@
+#!/usr/bin/env bash
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+. `dirname $0`/setenv.sh
+# Capture user's working dir before changing directory
+CWD="$PWD"
+cd ${AIRAVATA_HOME}/bin
+LOGO_FILE="logo.txt"
+
+JAVA_OPTS="-Dairavata.config.dir=${AIRAVATA_HOME}/conf -Dairavata.home=${AIRAVATA_HOME} -Dlog4j.configuration=file:${AIRAVATA_HOME}/conf/log4j.properties"
+AIRAVATA_COMMAND=""
+EXTRA_ARGS=""
+SERVERS=""
+IS_SUBSET=false
+SUBSET=""
+DEFAULT_LOG_FILE="${AIRAVATA_HOME}/logs/airavata.out"
+LOG_FILE=$DEFAULT_LOG_FILE
+
+# parse command arguments
+for var in "$@"
+do
+    case ${var} in
+        -xdebug)
+        	AIRAVATA_COMMAND="${AIRAVATA_COMMAND}"
+            JAVA_OPTS="$JAVA_OPTS -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,address=8000"
+            shift
+	    ;;
+        -log)
+            shift
+            LOG_FILE="$1"
+            shift
+            # If relative path, expand to absolute path using the user's $CWD
+            if [ -z "`echo "$LOG_FILE" | egrep "^/"`" ]; then
+                LOG_FILE="${CWD}/${LOG_FILE}"
+            fi
+        ;;
+        -h)
+            echo "Usage: realtime-monitor.sh"
+
+            echo "command options:"
+            echo "  -xdebug             Start Realtime Monitor under JPDA debugger"
+            echo "  -h                  Display this help and exit"
+            shift
+            exit 0
+        ;;
+	    *)
+	        EXTRA_ARGS="${EXTRA_ARGS} ${var}"
+            shift
+        ;;
+    esac
+done
+
+java ${JAVA_OPTS} -classpath "${AIRAVATA_CLASSPATH}" \
+    org.apache.airavata.monitor.realtime.RealtimeMonitor ${AIRAVATA_COMMAND} $*
+
diff --git a/modules/job-monitor/job-monitor-distribution/src/main/resources/realtime-monitor/bin/setenv.sh b/modules/job-monitor/job-monitor-distribution/src/main/resources/realtime-monitor/bin/setenv.sh
new file mode 100755
index 0000000..9e894e1
--- /dev/null
+++ b/modules/job-monitor/job-monitor-distribution/src/main/resources/realtime-monitor/bin/setenv.sh
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+# 
+# http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# resolve links - $0 may be a softlink
+PRG="$0"
+
+while [ -h "$PRG" ]; do
+  ls=`ls -ld "$PRG"`
+  link=`expr "$ls" : '.*-> \(.*\)$'`
+  if expr "$link" : '.*/.*' > /dev/null; then
+    PRG="$link"
+  else
+    PRG=`dirname "$PRG"`/"$link"
+  fi
+done
+
+PRGDIR=`dirname "$PRG"`
+
+# Only set AIRAVATA_HOME if not already set
+[ -z "$AIRAVATA_HOME" ] && AIRAVATA_HOME=`cd "$PRGDIR/.." ; pwd`
+
+AIRAVATA_CLASSPATH=""
+
+for f in "$AIRAVATA_HOME"/lib/*.jar
+do
+  AIRAVATA_CLASSPATH="$AIRAVATA_CLASSPATH":$f
+done
+
+export AIRAVATA_HOME
+export AIRAVATA_CLASSPATH
diff --git a/modules/job-monitor/email-monitor/src/main/resources/log4j.properties b/modules/job-monitor/job-monitor-distribution/src/main/resources/realtime-monitor/conf/airavata-server.properties
similarity index 59%
copy from modules/job-monitor/email-monitor/src/main/resources/log4j.properties
copy to modules/job-monitor/job-monitor-distribution/src/main/resources/realtime-monitor/conf/airavata-server.properties
index a2c8d83..ca569fd 100644
--- a/modules/job-monitor/email-monitor/src/main/resources/log4j.properties
+++ b/modules/job-monitor/job-monitor-distribution/src/main/resources/realtime-monitor/conf/airavata-server.properties
@@ -14,15 +14,15 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-# Set root logger level to DEBUG and its only appender to A1.
-log4j.rootLogger=INFO, A1
+#
+
+zookeeper.server.connection=localhost:2181
+zookeeper.timeout=30000
 
-log4j.category.org.apache.helix=WARN
-log4j.category.org.apache.kafka=INFO
-log4j.category.org.apache.zookeeper=WARN
-# A1 is set to be a ConsoleAppender.
-log4j.appender.A1=org.apache.log4j.ConsoleAppender
+realtime.monitor.broker.url=localhost:9092
+realtime.monitor.broker.consumer.group=monitor
+realtime.monitor.broker.topic=helix-airavata-mq
 
-# A1 uses PatternLayout.
-log4j.appender.A1.layout=org.apache.log4j.PatternLayout
-log4j.appender.A1.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss,SSS} %-4r [%t] %-5p %c %x - %m [E=%X{experiment},P=%X{process},T=%X{task},G=%X{gateway}]%n
\ No newline at end of file
+job.monitor.broker.url=localhost:9092
+job.monitor.broker.topic=parsed-data
+job.monitor.broker.publisher.id=RealtimeProducer
\ No newline at end of file
diff --git a/modules/airavata-helix-distribution/src/main/resources/conf/log4j.properties b/modules/job-monitor/job-monitor-distribution/src/main/resources/realtime-monitor/conf/log4j.properties
similarity index 54%
copy from modules/airavata-helix-distribution/src/main/resources/conf/log4j.properties
copy to modules/job-monitor/job-monitor-distribution/src/main/resources/realtime-monitor/conf/log4j.properties
index 870e7f0..7f9631c 100644
--- a/modules/airavata-helix-distribution/src/main/resources/conf/log4j.properties
+++ b/modules/job-monitor/job-monitor-distribution/src/main/resources/realtime-monitor/conf/log4j.properties
@@ -14,16 +14,19 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-# Set root logger level to DEBUG and its only appender to A1.
-log4j.rootLogger=INFO, A1
+
+log4j.rootLogger=INFO, CONSOLE, FILE
 
 log4j.category.org.apache.helix=WARN
 log4j.category.org.apache.zookeeper=WARN
-log4j.category.org.apache.airavata.helix.impl.task.submission.config.GroovyMapData=TRACE
-log4j.category.org.apache.airavata.helix.impl.task.submission.JobSubmissionTask=DEBUG
-# A1 is set to be a ConsoleAppender.
-log4j.appender.A1=org.apache.log4j.ConsoleAppender
 
-# A1 uses PatternLayout.
-log4j.appender.A1.layout=org.apache.log4j.PatternLayout
-log4j.appender.A1.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss,SSS} %-4r [%t] %-5p %c %x - %m [E=%X{experiment},P=%X{process},T=%X{task},G=%X{gateway}]%n
\ No newline at end of file
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss,SSS} %-4r [%t] %-5p %c %x - %m [E=%X{experiment},P=%X{process},T=%X{task},G=%X{gateway}]%n
+
+log4j.appender.FILE=org.apache.log4j.RollingFileAppender
+log4j.appender.FILE.File=${airavata.home}/logs/airavata.log
+log4j.appender.FILE.MaxFileSize=100MB
+log4j.appender.FILE.MaxBackupIndex=1
+log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
+log4j.appender.FILE.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss,SSS} %-4r [%t] %-5p %c %x - %m [E=%X{experiment},P=%X{process},T=%X{task},G=%X{gateway}]%n
\ No newline at end of file
diff --git a/modules/job-monitor/pom.xml b/modules/job-monitor/pom.xml
index c093e19..1d1b514 100644
--- a/modules/job-monitor/pom.xml
+++ b/modules/job-monitor/pom.xml
@@ -1,7 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
 
-
     Licensed to the Apache Software Foundation (ASF) under one
     or more contributor license agreements.  See the NOTICE file
     distributed with this work for additional information
@@ -37,34 +36,21 @@
         <module>job-monitor-api</module>
         <module>email-monitor</module>
         <module>real-time-monitor</module>
+        <module>job-monitor-distribution</module>
     </modules>
 
-    <dependencies>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
-            <version>1.7.25</version>
-        </dependency>
-        <dependency>
-            <groupId>javax.mail</groupId>
-            <artifactId>mail</artifactId>
-            <version>1.4.5</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.airavata</groupId>
-            <artifactId>airavata-commons</artifactId>
-            <version>0.17-SNAPSHOT</version>
-        </dependency>
-        <dependency>
-            <groupId>org.yaml</groupId>
-            <artifactId>snakeyaml</artifactId>
-            <version>1.15</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.kafka</groupId>
-            <artifactId>kafka-clients</artifactId>
-            <version>1.0.0</version>
-        </dependency>
-    </dependencies>
-
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.yaml</groupId>
+                <artifactId>snakeyaml</artifactId>
+                <version>1.15</version>
+            </dependency>
+            <dependency>
+                <groupId>javax.mail</groupId>
+                <artifactId>mail</artifactId>
+                <version>1.4.5</version>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
 </project>
\ No newline at end of file
diff --git a/modules/job-monitor/real-time-monitor/pom.xml b/modules/job-monitor/real-time-monitor/pom.xml
index 6cacf87..9639056 100644
--- a/modules/job-monitor/real-time-monitor/pom.xml
+++ b/modules/job-monitor/real-time-monitor/pom.xml
@@ -1,7 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
 
-
     Licensed to the Apache Software Foundation (ASF) under one
     or more contributor license agreements.  See the NOTICE file
     distributed with this work for additional information
@@ -39,6 +38,11 @@
             <version>0.17-SNAPSHOT</version>
         </dependency>
         <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>airavata-commons</artifactId>
+            <version>0.17-SNAPSHOT</version>
+        </dependency>
+        <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-log4j12</artifactId>
         </dependency>

-- 
To stop receiving notification emails like this one, please contact
dimuthuupe@apache.org.