AEM Startup Script

Following is the guide to create a system.d service for AEM 6.3
Step – 01: Create a bash script
$ sudo vi /usr/bin/aem
Step – 02: Add the following to the above created file
#!/bin/bash # # /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/cq.pid # Source function library. . /etc/rc.d/init.d/functions SCRIPT_NAME=`basename $0` AEM_ROOT=/opt/aem6 AEM_USER=aem ######## BIN=${AEM_ROOT}/crx-quickstart/bin START=${BIN}/start STOP=${BIN}/stop STATUS="${BIN}/status" case "$1" in start) echo -n "Starting AEM services: " su - ${AEM_USER} ${START} touch /var/lock/subsys/$SCRIPT_NAME ;; stop) echo -n "Shutting down AEM services: " su - ${AEM_USER} ${STOP} rm -f /var/lock/subsys/$SCRIPT_NAME ;; status) su - ${AEM_USER} ${STATUS} ;; restart) su - ${AEM_USER} ${STOP} su - ${AEM_USER} ${START} ;; reload) ;; *) echo "Usage: $SCRIPT_NAME {start|stop|status|reload}" exit 1 ;; esac
Step – 03: make the file executable
$ sudo chmod +x /usr/bin/aem
Step – 04: Create a system file
$ sudo vi /etc/systemd/system/aem.service
Step – 05: Add the following to the aem.service file
[Unit] Description=Adobe Experience Manager [Service] Type=simple ExecStart=/usr/bin/aem start ExecStop=/usr/bin/aem stop ExecReload=/usr/bin/aem restart RemainAfterExit=yes [Install] WantedBy=multi-user.target
Step – 06: Enabling the system entry
$ sudo systemctl enable aem.service $ sudo systemctl daemon-reload $ sudo chmod +x aem.service
Step – 07: AEM service usage
$ sudo systemctl start aem $ sudo systemctl stop aem $ sudo systemctl status aem $ sudo systemctl restart aem
Categories
Adobe Experience Manager, Adobe Experience Manager 6.x, AEM, aem63, Linux, rhel, Startup Script, Terminal