You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ao...@apache.org on 2016/02/12 10:39:25 UTC
ambari git commit: AMBARI-14842. ambari agent upstart support
(aonishuk)
Repository: ambari
Updated Branches:
refs/heads/branch-2.2 bf8ecffed -> 3c0c22c17
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/3c0c22c1
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/3c0c22c1
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/3c0c22c1
Branch: refs/heads/branch-2.2
Commit: 3c0c22c17bc759b676282b551fe69598b59c08ba
Parents: bf8ecff
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Fri Feb 12 11:39:06 2016 +0200
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Fri Feb 12 11:39:06 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/3c0c22c1/ambari-agent/conf/unix/ambari-agent
----------------------------------------------------------------------
diff --git a/ambari-agent/conf/unix/ambari-agent b/ambari-agent/conf/unix/ambari-agent
index ba0bb65..31e4100 100755
--- a/ambari-agent/conf/unix/ambari-agent
+++ b/ambari-agent/conf/unix/ambari-agent
@@ -153,7 +153,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..."
@@ -215,6 +222,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/3c0c22c1/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/3c0c22c1/ambari-agent/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-agent/pom.xml b/ambari-agent/pom.xml
index 876cc78..8edbb7c 100644
--- a/ambari-agent/pom.xml
+++ b/ambari-agent/pom.xml
@@ -397,6 +397,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>
@@ -608,6 +619,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>