Linux init script for AEM


How do I create a Linux init script to manage my AEM java process?


A sample Linux init script (tested in Redhat Linux) is provided below.

To use the init script:

1. Copy the script to a new file /etc/init.d/aem6 on your server.

2. Edit the file and make the following changes:​

  • Set AEM_ROOT variable to the directory path which contains the AEM jar file.
  • Set AEM_USER variable to the name of the system user that will start and stop AEM.
3. Run the command:​ chmod 755 /etc/init.d/aem6   4. Run this command to add the config to redhat startup and shutdown: chkconfig --add aem6

Prior to installing AEM as a Linux service:

1. AEM should have already been installed or unpacked from the installation jar file and your file should already be in place.  See the official documentation for more details.

2. Verify that the start and stop scripts installed with AEM are working as expected. The scripts are located under /crx-quickstart/bin.

  • Allocate enough heap space to the JVM by setting the -Xmx parameter in the CQ_JVM_OPTS variable.
  • Make sure the correct java binary is accessible via the Path of the AEM process user's shell (AEM_USER variable).

Sample Init Script

# /etc/rc.d/init.d/aem6
# # of the file to the end of the tags section must begin with a #
# character. After the tags section, there should be a blank line.
# This keeps normal comments in the rest of the file from being
# mistaken for tags, should they happen to fit the pattern.>
# chkconfig: 35 85 15
# description: This service manages the Adobe Experience Manager java process.
# processname: aem6
# pidfile: ${AEM_ROOT}/crx-quickstart/conf/

# Source function library.
. /etc/rc.d/init.d/functions

SCRIPT_NAME=`basename $0`


case "$1" in
echo -n "Starting AEM services: "
su - ${AEM_USER} ${START}
touch /var/lock/subsys/$SCRIPT_NAME
echo -n "Shutting down AEM services: "
su - ${AEM_USER} ${STOP}
rm -f /var/lock/subsys/$SCRIPT_NAME
su - ${AEM_USER} ${STATUS}
su - ${AEM_USER} ${STOP}
su - ${AEM_USER} ${START}
echo "Usage: $SCRIPT_NAME {start|stop|status|reload}"
exit 1
Logo Adobe

Zaloguj się na swoje konto