Ryan McCullough – Adobe /adobe-blog Perspectives on Adobe Digital Marketing Platform Technologies Wed, 22 Jun 2016 17:47:21 +0000 en-US hourly 1 https://wordpress.org/?v=4.5.3 Copyright © Perficient Blogs 2011 gserafini@gmail.com (Adobe) gserafini@gmail.com (Adobe) /adobe-blog/wp-content/plugins/podpress/images/powered_by_podpress.jpg Adobe /adobe-blog 144 144 Blogs at Perficient Adobe Adobe gserafini@gmail.com no no Start AEM Automatically Using SystemD /adobe-blog/2016/06/17/start-aem-automatically-using-systemd/ /adobe-blog/2016/06/17/start-aem-automatically-using-systemd/#respond Fri, 17 Jun 2016 17:34:20 +0000 /adobe-blog/?p=8851 Start AEM Automatically Using SystemD was first posted on June 17, 2016 at 12:34 pm.
©2016 "Adobe". Use of this feed is for personal non-commercial use only. If you are not reading this article in your feed reader, then the site is guilty of copyright infringement. Please contact me at gserafini@gmail.com
]]>
With the release of RedHat and CentOS 7.x, the previously used method, init.d, for starting AEM as a service will no longer function.  Out with the old SysV, in with system.d!  This has a long history that I won’t get into here, but for your reference here is a great article which articulates why the previous init SysV method is being depreciated in favour of system.d.

Now, onto the fun stuff.  How can we modify (or create) a system.d init script that will work with AEM?  Well, I’ll walk you through how to do this using the standard init.d AEM script.  If you have your own already, feel free to substitute it into the instructions.

You can grab a copy of the standard AEM init.d here (or here).

And here is the corresponding system.d file.

Now that we’re on the same page, lets get a few things straight:

  • If you generated your init.d script (from above) these instructions use the filename aem and location /usr/bin/aem for the location of this script.  If you are using different values, please ensure the aem.system script is updated accordingly.
    • This script should be readable and executable by the root
    • AEM_USER
      • The system user in which AEM is expected to run under.  Be certain to start up an AEM instance using this user prior to going through these instructions to be sure they have appropriate permissions to the crx-quickstart folder
      • Default value is “aem”
    • AEM_ROOT
      • The root folder of AEM, or the parent folder of the crx-quickstart folder.
      • ex. if your crx-quickstart folder is /opt/aem6/crx-quickstart, the root folder would be /opt/aem6
      • Default value is /opt/aem6
  • aem.system is a (very) basic system.d script generated for your standard AEM init.d.  In it there are several places which reference the existing aem script.  It is assuming that your aem init.d script (see above for link) is located at /usr/bin/aem.  This location can be modified to any you like, just ensure that:
    • It must be readable and executable by the root user
    • If the location of your aem script is not /usr/bin/aem, update references to ExecStart, ExecStop, and ExecReload accordingly
    • If your aem script does not include a restart, feel free to remove the ExecReload line as it will not function as expected.

Now for the official instructions:

  1. (If no existing init.d) Download the sample init.d script here
    1. Open the file and modify the AEM_USER and AEM_ROOT variables to suit your environment (see above for description)
    2. Save the file to your file system.  This can be saved anywhere – the example aem.system file uses /usr/bin/aem.
    3. Ensure that the file is readable and writable as root:
      # sudo chmod u+rwx /usr/bin/aem
    4. Test the file works as expected
      # ./usr/bin/aem start
  2. Download the aem.system file.
    1. (If you are not using /usr/bin/aem) – Modify the aem.system file by updating the location referenced by ExecStart, ExecStop, and ExecReload to match the scripts location
    2. Save the script to /etc/system.d/system/aem.system
    3. Ensure that the file is readable and writable as root:
      1. # sudo chmod u+rwx /etc/system.d/system/aem.system
    4. Enable the system.d entry:
      1. # cd /etc/system.d/system
        # systemctl enable aem.system

That’s it!  On your next reboot, AEM should be started as expected.


Start AEM Automatically Using SystemD was first posted on June 17, 2016 at 12:34 pm.
©2016 "Adobe". Use of this feed is for personal non-commercial use only. If you are not reading this article in your feed reader, then the site is guilty of copyright infringement. Please contact me at gserafini@gmail.com
]]>
/adobe-blog/2016/06/17/start-aem-automatically-using-systemd/feed/ 0