incubator-ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From swa...@apache.org
Subject svn commit: r1453473 - in /incubator/ambari/trunk: ./ ambari-agent/ ambari-agent/etc/ ambari-agent/etc/init.d/ ambari-server/ ambari-server/etc/ ambari-server/etc/init.d/ ambari-server/sbin/ ambari-server/src/main/python/
Date Wed, 06 Mar 2013 18:47:56 GMT
Author: swagle
Date: Wed Mar  6 18:47:55 2013
New Revision: 1453473

URL: http://svn.apache.org/r1453473
Log:
AMBARI-1492. Add init.d scripts for Ambari server + agent. (swagle)

Added:
    incubator/ambari/trunk/ambari-agent/etc/
    incubator/ambari/trunk/ambari-agent/etc/init.d/
    incubator/ambari/trunk/ambari-agent/etc/init.d/ambari-agent
    incubator/ambari/trunk/ambari-server/etc/
    incubator/ambari/trunk/ambari-server/etc/init.d/
    incubator/ambari/trunk/ambari-server/etc/init.d/ambari-server
Modified:
    incubator/ambari/trunk/CHANGES.txt
    incubator/ambari/trunk/ambari-agent/pom.xml
    incubator/ambari/trunk/ambari-server/pom.xml
    incubator/ambari/trunk/ambari-server/sbin/ambari-server
    incubator/ambari/trunk/ambari-server/src/main/python/ambari-server.py

Modified: incubator/ambari/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1453473&r1=1453472&r2=1453473&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Wed Mar  6 18:47:55 2013
@@ -416,6 +416,8 @@ Trunk (unreleased changes):
 
  BUG FIXES
 
+ AMBARI-1492. Add init.d scripts for Ambari server + agent. (swagle)
+
  AMBARI-1548. Implement Stacks API using the consistent API framework in 
  Ambari Server with all the get/predicates working. (swagle)
 

Added: incubator/ambari/trunk/ambari-agent/etc/init.d/ambari-agent
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/etc/init.d/ambari-agent?rev=1453473&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-agent/etc/init.d/ambari-agent (added)
+++ incubator/ambari/trunk/ambari-agent/etc/init.d/ambari-agent Wed Mar  6 18:47:55 2013
@@ -0,0 +1,41 @@
+#!/usr/bin/env bash
+# chkconfig: 345 20 80
+# description: ambari-agent daemon
+# processname: ambari-agent
+
+# 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.
+
+case "$1" in
+  start)
+        /usr/sbin/ambari-agent $@
+        ;;
+  stop)
+        /usr/sbin/ambari-agent $@
+        ;;
+  status)
+        /usr/sbin/ambari-agent $@
+        ;;
+  restart)
+        $0 stop
+        $0 start
+        ;;
+  *)
+        echo "Usage: $0 {start|stop|status|restart}"
+        exit 1
+esac
+
+exit 0

Modified: incubator/ambari/trunk/ambari-agent/pom.xml
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/pom.xml?rev=1453473&r1=1453472&r2=1453473&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-agent/pom.xml (original)
+++ incubator/ambari/trunk/ambari-agent/pom.xml Wed Mar  6 18:47:55 2013
@@ -278,6 +278,17 @@
               <username>root</username>
               <groupname>root</groupname>
             </mapping>
+            <mapping>
+              <directory>/etc/rc.d/init.d</directory>
+              <filemode>755</filemode>
+              <username>root</username>
+              <groupname>root</groupname>
+              <sources>
+                <source>
+                  <location>etc/init.d/ambari-agent</location>
+                </source>
+              </sources>
+            </mapping>
             <!-- -->
           </mappings>
         </configuration>

Added: incubator/ambari/trunk/ambari-server/etc/init.d/ambari-server
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/etc/init.d/ambari-server?rev=1453473&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-server/etc/init.d/ambari-server (added)
+++ incubator/ambari/trunk/ambari-server/etc/init.d/ambari-server Wed Mar  6 18:47:55 2013
@@ -0,0 +1,41 @@
+#!/usr/bin/env bash
+# chkconfig: 345 20 80
+# description: ambari-server daemon
+# processname: ambari-server
+
+# 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.
+
+case "$1" in
+  start)
+        /usr/sbin/ambari-server $@
+        ;;
+  stop)
+        /usr/sbin/ambari-server $@
+        ;;
+  status)
+        /usr/sbin/ambari-server $@
+        ;;
+  restart)
+        $0 stop
+        $0 start
+        ;;
+  *)
+        echo "Usage: $0 {start|stop|status|restart}"
+        exit 1
+esac
+
+exit 0

Modified: incubator/ambari/trunk/ambari-server/pom.xml
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/pom.xml?rev=1453473&r1=1453472&r2=1453473&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/pom.xml (original)
+++ incubator/ambari/trunk/ambari-server/pom.xml Wed Mar  6 18:47:55 2013
@@ -299,6 +299,17 @@
               <username>root</username>
               <groupname>root</groupname>
             </mapping>
+            <mapping>
+              <directory>/etc/rc.d/init.d</directory>
+              <filemode>755</filemode>
+              <username>root</username>
+              <groupname>root</groupname>
+              <sources>
+                <source>
+                  <location>etc/init.d/ambari-server</location>
+                </source>
+              </sources>
+            </mapping>
           </mappings>
         </configuration>
       </plugin>

Modified: incubator/ambari/trunk/ambari-server/sbin/ambari-server
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/sbin/ambari-server?rev=1453473&r1=1453472&r2=1453473&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/sbin/ambari-server (original)
+++ incubator/ambari/trunk/ambari-server/sbin/ambari-server Wed Mar  6 18:47:55 2013
@@ -77,6 +77,10 @@ case "$1" in
         echo -e "Upgrading ambari-server"
         $PYTHON /usr/sbin/ambari-server.py $@
         ;;
+  status)
+        echo -e "Ambari-server status"
+        $PYTHON /usr/sbin/ambari-server.py $@
+        ;;
   upgradestack)
         echo -e "Upgrading stack of ambari-server"
         $PYTHON /usr/sbin/ambari-server.py $@
@@ -93,7 +97,7 @@ case "$1" in
         $PYTHON /usr/sbin/ambari-server.py $@
         ;;
   *)
-        echo "Usage: /usr/sbin/ambari-server {start|stop|restart|setup|upgrade|upgradestack}
[options]"
+        echo "Usage: /usr/sbin/ambari-server {start|stop|restart|setup|upgrade|status|upgradestack}
[options]"
         exit 1
 esac
 

Modified: incubator/ambari/trunk/ambari-server/src/main/python/ambari-server.py
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/main/python/ambari-server.py?rev=1453473&r1=1453472&r2=1453473&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/main/python/ambari-server.py (original)
+++ incubator/ambari/trunk/ambari-server/src/main/python/ambari-server.py Wed Mar  6 18:47:55
2013
@@ -46,6 +46,7 @@ STOP_ACTION = "stop"
 RESET_ACTION = "reset"
 UPGRADE_ACTION = "upgrade"
 UPGRADE_STACK_ACTION = "upgradestack"
+STATUS_ACTION = "status"
 
 # selinux commands
 GET_SE_LINUX_ST_CMD = "/usr/sbin/sestatus"
@@ -893,6 +894,27 @@ def upgrade(args):
 
   print "Ambari Server 'upgrade' finished successfully"
 
+
+#
+# The Ambari Server status.
+#
+def status(args):
+  if os.path.exists(PID_DIR + os.sep + PID_NAME):
+    f = open(PID_DIR + os.sep + PID_NAME, "r")
+    pid = int(f.readline())
+    print "Found Ambari Server PID: '" + str(pid) + "'"
+    f.close()
+    retcode, out, err = run_os_command("ps -p " + str(pid))
+    if retcode == 0:
+      print "Ambari Server running"
+      print "Ambari Server PID at: " + PID_DIR + os.sep + PID_NAME
+    else:
+      print "Ambari Server not running. Stale PID File at: " + PID_DIR + os.sep + PID_NAME
+  else:
+    print "Ambari Server not running"
+
+
+
 #
 # Prints an "info" messsage.
 #
@@ -1116,6 +1138,8 @@ def main():
     stop(options)
   elif action == RESET_ACTION:
     reset(options)
+  elif action == STATUS_ACTION:
+    status(options)
   elif action == UPGRADE_ACTION:
     upgrade(options)
   elif action == UPGRADE_STACK_ACTION:



Mime
View raw message