I'm trying to setup AEM (Adobe Experience Manager) Author as a Service on Ubuntu 18.04 on an AWS EC2 instance.
Script file "aem" at `/usr/bin/aem` (file permissions to "root")
#!/bin/bash
#
# description: This service manages the Adobe Experience Manager java process.
# processname: aem6
. /lib/lsb/init-functions
SCRIPT_NAME=`basename $0`
AEM_ROOT=/opt/aem/author
AEM_USER=root
########
BIN=${AEM_ROOT}/crx-quickstart/bin
START=${BIN}/start
STOP=${BIN}/stop
STATUS=${BIN}/status
case "$1" in
start)
if [ -f $START ]; then
echo "Starting AEM Service.."
/bin/su -l $AEM_USER -c $START
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/${SCRIPT_NAME}
fi
;;
stop)
if [ -f $STOP ]; then
echo "Stopping AEM Service.."
/bin/su -l $AEM_USER -c $STOP
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/${SCRIPT_NAME}
fi
;;
status)
if [ -f $STATUS ]; then
echo -s "Checking status of $SCRIPT_NAME: "
/bin/su -l $AEM_USER -c $STATUS
RETVAL=$?
[ $RETVAL -eq 0 ] && echo "$SCRIPT_NAME is running"
fi
;;
restart)
/bin/su -l ${AEM_USER} -c ${STOP}
/bin/su -l ${AEM_USER} -c ${START}
;;
reload)
;;
*)
echo "Usage: $0 {start|stop|status|reload}"
RETVAL=1
;;
esac
exit $RETVAL
Service file at `/etc/systemd/system/aem.service` (file permissions to "root")
[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
When checking the service status:
ubuntu@ip-109:~$ sudo systemctl status aem
aem.service - Adobe Experience Manager
Loaded: loaded (/etc/systemd/system/aem.service; enabled; vendor preset: enabled)
Active: active (exited) since Wed 2019-10-23 20:25:21 UTC; 3min 24s ago
Process: 20106 ExecStart=/usr/bin/aem start (code=exited, status=0/SUCCESS)
Main PID: 20106 (code=exited, status=0/SUCCESS)
Oct 23 20:25:21 ip-172-31-14-109 systemd[1]: Started Adobe Experience Manager.
Oct 23 20:25:21 ip-172-31-14-109 aem[20106]: Starting AEM Service..
Oct 23 20:25:21 ip-172-31-14-109 su[20122]: Successful su for root by root
Oct 23 20:25:21 ip-172-31-14-109 su[20122]: + ??? root:root
Oct 23 20:25:21 ip-172-31-14-109 su[20122]: pam_unix(su:session): session opened for user root by (uid=0)
Oct 23 20:25:21 ip-172-31-14-109 aem[20106]: mesg: ttyname failed: Inappropriate ioctl for device
Oct 23 20:25:21 ip-172-31-14-109 su[20122]: pam_unix(su:session): session closed for user root
But cannot see "java" process (using `ps -ef | grep java` ) or port "4502" being used (using `sudo lsof -i -P -n | grep LISTEN`).
What am i missing?
Solved! Go to Solution.
Views
Replies
Total Likes
Was able to resolve the issue. the problem was with "java" not being available to all users. Earlier installed Oracle Java using default (ubuntu) user, while the aem
script was running as root
.
Steps to install custom Java.. not the Ubuntu default:
After this, start "aem" service again. It should be running!
Views
Replies
Total Likes
Do you see anything in the error.log file?
Views
Replies
Total Likes
No.. nothing is being printed.
But i looked at all.. i found this under stdout.log
/opt/aem/author/crx-quickstart/bin/start: line 139: java: command not found
"java" is installed.. it is available to "ubuntu" (default) user, maybe not "root".
Views
Replies
Total Likes
Was able to resolve the issue. the problem was with "java" not being available to all users. Earlier installed Oracle Java using default (ubuntu) user, while the aem
script was running as root
.
Steps to install custom Java.. not the Ubuntu default:
After this, start "aem" service again. It should be running!
Views
Replies
Total Likes
Views
Likes
Replies