无法在Ubuntu 18.04上作为服务启动AEM

问题描述 投票:0回答:1

我正在尝试在AWS EC2实例上的Ubuntu 18.04上将AEM(Adobe Experience Manager)作者设置为服务。

/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处的服务文件(对“ 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

检查服务状态时:

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

但是无法看到“ java”进程(使用ps -ef | grep java)或正在使用端口“ 4502”(使用sudo lsof -i -P -n | grep LISTEN)。

我想念什么?

shell ubuntu aem
1个回答
0
投票

能够解决此问题。问题在于“ java”并非对所有用户都可用。 aem脚本以root身份运行时,使用默认(ubuntu)用户安装了Oracle Java。

安装定制Java ..而不是Ubuntu默认设置的步骤:

  • 将路径添加到“ .bashrc”。打开以编辑sudo nano ~/.bashrc
    • 将这些行添加到文件末尾:
      • export JAVA_HOME=/opt/java/jdk1.8.0_231
      • export PATH=${PATH}:${JAVA_HOME}/bin
  • 此之后..重新启动“ aem”服务。它应该可以正常工作!

    © www.soinside.com 2019 - 2024. All rights reserved.