You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by be...@apache.org on 2019/02/20 09:00:14 UTC

[ambari] branch branch-2.7 updated: AMBARI-25151 SystemD support for ambari-agent on SLES12 (benyoka) (#2819)

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

benyoka pushed a commit to branch branch-2.7
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-2.7 by this push:
     new f0153c5  AMBARI-25151 SystemD support for ambari-agent on SLES12 (benyoka) (#2819)
f0153c5 is described below

commit f0153c5c90f47d1df2f816b8f8e195880e931bae
Author: benyoka <be...@users.noreply.github.com>
AuthorDate: Wed Feb 20 10:00:04 2019 +0100

    AMBARI-25151 SystemD support for ambari-agent on SLES12 (benyoka) (#2819)
    
    * AMBARI-25151 SystemD support for ambari-agent on SLES12 (benyoka)
    
    * AMBARI-25151 fix service unit file (benyoka)
    
    * AMBARI-25151 fix service unit file (benyoka)
    
    * AMBARI-25151 review comment (benyoka)
    
    * AMBARI-25151 remove runlevel 2 and 4 (benyoka)
    
    * AMBARI-25151 add pidfile, disable RemainAfterExit (benyoka)
---
 ambari-agent/conf/unix/ambari-agent.service | 39 +++++++++++++++++++++++++++++
 ambari-agent/pom.xml                        | 31 +++++++++++++++++++++--
 ambari-agent/src/packages/tarball/all.xml   |  5 ++++
 3 files changed, 73 insertions(+), 2 deletions(-)

diff --git a/ambari-agent/conf/unix/ambari-agent.service b/ambari-agent/conf/unix/ambari-agent.service
new file mode 100644
index 0000000..adc22de
--- /dev/null
+++ b/ambari-agent/conf/unix/ambari-agent.service
@@ -0,0 +1,39 @@
+# 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
+
+# This service unit file is tuned for SLES 12.x. It is not suitable for RHEL like distributions due to different
+# paths for ExecStart/ExecStop.
+
+[Unit]
+Description=Ambari Agent Service for SLES
+Before=runlevel3.target
+Before=runlevel5.target
+Before=shutdown.target
+After=remote-fs.target
+After=network-online.target
+Wants=network-online.target
+Conflicts=shutdown.target
+
+[Service]
+Type=forking
+PIDFile=/run/ambari-agent/ambari-agent.pid
+Restart=no
+TimeoutSec=5min
+IgnoreSIGPIPE=no
+KillMode=process
+GuessMainPID=no
+RemainAfterExit=no
+TasksMax=infinity
+ExecStart=/etc/init.d/ambari-agent start
+ExecStop=/etc/init.d/ambari-agent stop
diff --git a/ambari-agent/pom.xml b/ambari-agent/pom.xml
index a2b4cd4..18c77f4 100644
--- a/ambari-agent/pom.xml
+++ b/ambari-agent/pom.xml
@@ -273,7 +273,6 @@
           </execution>
         </executions>
         <configuration>
-
           <copyright>2012, Apache Software Foundation</copyright>
           <group>Development</group>
           <description>Maven Recipe: RPM Package.</description>
@@ -303,7 +302,7 @@
 
           <needarch>x86_64</needarch>
           <autoRequires>false</autoRequires>
-          <mappings>
+          <mappings combine.children="append">
             <mapping>
               <directory>/etc</directory>
               <username>root</username>
@@ -703,6 +702,34 @@
      </properties>
     </profile>
     <profile>
+      <id>suse12</id>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.codehaus.mojo</groupId>
+            <artifactId>rpm-maven-plugin</artifactId>
+            <configuration>
+              <group>Development</group>
+              <mappings>
+                <mapping>
+                  <directory>/usr/lib/systemd/system/</directory>
+                  <username>root</username>
+                  <groupname>root</groupname>
+                  <filemode>644</filemode>
+                  <directoryIncluded>false</directoryIncluded>
+                  <sources>
+                    <source>
+                      <location>${project.build.directory}${dirsep}${project.artifactId}-${project.version}${dirsep}usr${dirsep}lib${dirsep}systemd${dirsep}system${dirsep}ambari-agent.service</location>
+                    </source>
+                  </sources>
+                </mapping>
+              </mappings>
+            </configuration>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+    <profile>
       <id>windows-distro</id>
       <activation>
         <os>
diff --git a/ambari-agent/src/packages/tarball/all.xml b/ambari-agent/src/packages/tarball/all.xml
index 2ff57cd..5f8c273 100644
--- a/ambari-agent/src/packages/tarball/all.xml
+++ b/ambari-agent/src/packages/tarball/all.xml
@@ -186,6 +186,11 @@
       <outputDirectory>/etc/ambari-agent/conf</outputDirectory>
     </file>
     <file>
+      <fileMode>644</fileMode>
+      <source>conf/unix/ambari-agent.service</source>
+      <outputDirectory>/usr/lib/systemd/system</outputDirectory>
+    </file>
+    <file>
       <fileMode>755</fileMode>
       <source>${basedir}/target/src/ambari-agent</source>
       <outputDirectory>/var/lib/ambari-agent/bin</outputDirectory>