我正在尝试在亚马逊网络服务EC2实例的Ubuntu18.04上设置AEM (Adobe体验管理器) Author as a Service。
/usr/bin/aem上的脚本文件"aem“(对”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根目录下的服务文件(“/etc/systemd/system/aem.service”的文件权限)
[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检查服务状态时:
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但是看不到“sudo lsof -i -P -n | grep LISTEN”进程(使用ps -ef | grep java )或端口"4502“正在使用(使用java)。
我遗漏了什么?
发布于 2019-10-24 22:23:46
能够解决这个问题。问题在于"java“并非对所有用户都可用。在以root身份运行aem脚本时,使用默认(ubuntu)用户安装了Oracle Java。
安装自定义Java的步骤..不是Ubuntu默认设置:
使用SCP 231-linux-x64.tar.gz"
tar.gz。运行此命令sudo update-alternatives --install /usr/bin/java java /opt/java/jdk1.8.0_231/bin/java 1
sudo nano ~/.bashrc export JAVA_HOME=/opt/java/jdk1.8.0_231export PATH=${PATH}:${JAVA_HOME}/bin
在这之后..。再次启动"aem“服务。它应该是有效的!
https://stackoverflow.com/questions/58530943
复制相似问题