I have installed aem6.2 on Ubuntu 16.04.1 which runs on an Amzon EC2 instance.
Now I wish aem should restart automatically on system reboot.
So added below script to /etc/init.d/aem62
#!/bin/bash
#
### BEGIN INIT INFO
# Provides: aem62
# Required-Start: $local_fs
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: aem62
### END INIT INFO
# Source function library.
#. /etc/rc.d/init.d/functions
SCRIPT_NAME=`basename $0`
AEM6_ROOT=/opt/aem62/publish
AEM6_USER=root
########
SERVER="${AEM6_ROOT}/crx-quickstart"
START="${SERVER}/bin/start"
STOP="${SERVER}/bin/stop"
STATUS="${SERVER}/bin/status"
case "$1" in
start)
echo -n "Starting aem62 services... "
echo
su - ${AEM6_USER} ${START}
touch /var/lock/subsys/aem62
;;
stop)
echo -n "Shutting down aem62 services... "
su - ${AEM6_USER} ${STOP}
rm -f /var/lock/subsys/aem62
;;
status)
su - ${AEM6_USER} ${STATUS}
;;
restart)
su - ${AEM6_USER} ${STOP}
su - ${AEM6_USER} ${START}
;;
*)
echo "Usage: aem62 {start|stop|status|restart}"
exit 1
;;
esac
and issue the following commands:
chmod 755 aem62
update-rc.d aem62 defaults
but when i check the status of aem service after Ubuntu reboot, get the bellowing log.
root@ip-10-0-3-10:/etc# service aem62 status
● aem62.service - LSB: aem62
Loaded: loaded (/etc/init.d/aem62; bad; vendor preset: enabled)
Active: failed (Result: resources) since Mon 2016-10-31 05:56:46 UTC; 20min ago
Docs: man:systemd-sysv-generator(8)
Oct 31 05:56:44 ip-10-0-3-10 systemd[1]: Starting LSB: aem62...
Oct 31 05:56:44 ip-10-0-3-10 aem62[745]: Starting aem62 services...
Oct 31 05:56:44 ip-10-0-3-10 su[750]: Successful su for root by root
Oct 31 05:56:44 ip-10-0-3-10 su[750]: + ??? root:root
Oct 31 05:56:44 ip-10-0-3-10 su[750]: pam_unix(su:session): session opened for user root by (uid=0)
Oct 31 05:56:46 ip-10-0-3-10 aem62[745]: mesg: ttyname failed: Inappropriate ioctl for device
Oct 31 05:56:46 ip-10-0-3-10 systemd[1]: aem62.service: PID file /crx-quickstart/conf/cq.pid not readable (yet?) after start: No such file or directory
Oct 31 05:56:46 ip-10-0-3-10 systemd[1]: Failed to start LSB: aem62.
Oct 31 05:56:46 ip-10-0-3-10 systemd[1]: aem62.service: Unit entered failed state.
Oct 31 05:56:46 ip-10-0-3-10 systemd[1]: aem62.service: Failed with result 'resources'.
I don't know why service access cq.pid file in /crx-quickstart/conf directory.
Could you tell me how configure it to start automatically,even if no one is logged into the PC?
Thanks.