Step – 01: Create a bash script
[code lang=bash]
$ sudo vi /usr/bin/aem
[/code]
Step – 02: Add the following to the above-created file
[code lang=bash]
#!/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
[/code]
Step – 03: make the file executable
[code lang=bash]
$ sudo chmod +x /usr/bin/aem
[/code]
Step – 04: Create a system file
[code lang=bash]
$ sudo vi /etc/systemd/system/aem.service
[/code]
Step – 05: Add the following to the aem.service file
[code lang=bash]
[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
[/code]
Step – 06: Enabling the system entry
[code lang=bash]
$ sudo systemctl enable aem.service
$ sudo systemctl daemon-reload
$ sudo chmod +x aem.service
[/code]
Step – 07: AEM service usage
[code lang=bash]
$ sudo systemctl start aem
$ sudo systemctl stop aem
$ sudo systemctl status aem
$ sudo systemctl restart aem
[/code]
No comments:
Post a Comment
If you have any doubts or questions, please let us know.