ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aonis...@apache.org
Subject ambari git commit: AMBARI-14842. ambari agent upstart support (aonishuk)
Date Fri, 29 Jan 2016 11:41:44 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk a2f436a61 -> 6d83195a7


AMBARI-14842. ambari agent upstart support (aonishuk)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/6d83195a
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/6d83195a
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/6d83195a

Branch: refs/heads/trunk
Commit: 6d83195a72a1dc6435ebf29fd470c512a49b7a69
Parents: a2f436a
Author: Andrew Onishuk <aonishuk@hortonworks.com>
Authored: Fri Jan 29 13:41:28 2016 +0200
Committer: Andrew Onishuk <aonishuk@hortonworks.com>
Committed: Fri Jan 29 13:41:28 2016 +0200

----------------------------------------------------------------------
 ambari-agent/conf/unix/ambari-agent     | 13 +++++++++++
 ambari-agent/etc/init/ambari-agent.conf | 34 ++++++++++++++++++++++++++++
 ambari-agent/pom.xml                    | 22 ++++++++++++++++++
 3 files changed, 69 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/6d83195a/ambari-agent/conf/unix/ambari-agent
----------------------------------------------------------------------
diff --git a/ambari-agent/conf/unix/ambari-agent b/ambari-agent/conf/unix/ambari-agent
index 4f9e1e5..96ef12b 100755
--- a/ambari-agent/conf/unix/ambari-agent
+++ b/ambari-agent/conf/unix/ambari-agent
@@ -157,7 +157,14 @@ case "$1" in
         change_files_permissions
         
         echo "Starting ambari-agent"
+        
+        if [ "$AMBARI_AGENT_RUN_IN_FOREGROUND" == true ] ; then
+          $PYTHON $AMBARI_AGENT_PY_SCRIPT "$@" > $OUTFILE 2>&1 
+          exit $?
+        fi
+        
         nohup $PYTHON $AMBARI_AGENT_PY_SCRIPT "$@" > $OUTFILE 2>&1 &
+        
         sleep 2
         PID=$!
         echo "Verifying $AMBARI_AGENT process status..."
@@ -219,6 +226,12 @@ case "$1" in
             echo "Stopping $AMBARI_AGENT"
             change_files_permissions
             $PYTHON $AGENT_SCRIPT stop
+            
+            status ambari-agent 2>/dev/null | grep start 1>/dev/null
+            if [ "$?" -eq 0 ] ; then
+              echo "Stopping $AMBARI_AGENT upstart job"
+              stop ambari-agent > /dev/null
+            fi
           fi
           echo "Removing PID file at $PIDFILE"
           ambari-sudo.sh rm -f $PIDFILE

http://git-wip-us.apache.org/repos/asf/ambari/blob/6d83195a/ambari-agent/etc/init/ambari-agent.conf
----------------------------------------------------------------------
diff --git a/ambari-agent/etc/init/ambari-agent.conf b/ambari-agent/etc/init/ambari-agent.conf
new file mode 100644
index 0000000..021eb3b
--- /dev/null
+++ b/ambari-agent/etc/init/ambari-agent.conf
@@ -0,0 +1,34 @@
+# 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
+
+#ambari-agent
+description     "ambari agent"
+
+stop on runlevel [06]
+
+env PIDFILE=/var/run/ambari-agent/ambari-agent.pid
+
+kill signal SIGKILL
+respawn
+
+script
+   . /etc/environment
+
+   export AMBARI_AGENT_RUN_IN_FOREGROUND=true
+   exec /etc/init.d/ambari-agent start
+end script
+
+post-stop script
+  rm -f $PIDFILE
+end script
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/6d83195a/ambari-agent/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-agent/pom.xml b/ambari-agent/pom.xml
index 346ac07..dbbb5ad 100644
--- a/ambari-agent/pom.xml
+++ b/ambari-agent/pom.xml
@@ -409,6 +409,17 @@
               <groupname>root</groupname>
             </mapping>
             <mapping>
+              <directory>/etc/init</directory>
+              <filemode>755</filemode>
+              <username>root</username>
+              <groupname>root</groupname>
+              <sources>
+                <source>
+                  <location>etc/init/ambari-agent.conf</location>
+                </source>
+              </sources>
+            </mapping>
+            <mapping>
               <directory>${init.d.dir}</directory>
               <filemode>755</filemode>
               <username>root</username>
@@ -620,6 +631,17 @@
               </mapper>
             </data>
             <data>
+              <src>etc/init/ambari-agent.conf</src>
+              <type>file</type>
+              <mapper>
+                <type>perm</type>
+                <prefix>/etc/init</prefix>
+                <user>root</user>
+                <group>root</group>
+                <filemode>755</filemode>
+              </mapper>
+            </data>
+            <data>
               <src>${basedir}/target/src/version</src>
               <type>file</type>
               <mapper>


Mime
View raw message