AEM Upstart Script creates multiple java processes | Community
Skip to main content
Level 3
December 2, 2015
Solved

AEM Upstart Script creates multiple java processes

  • December 2, 2015
  • 5 replies
  • 2039 views

Hi,

I am trying to create an upstart script for AEM server start/stop. It spawns 11 java processes when I run it (sudo start aemservice). Any pointers to what I might be doing wrong.

Here is the script

start on runlevel[2345]
stop on runlevel[016]

respawn

env SERVER_HOME=/app/server/aem61
env JAVA_HOME=/home/abhishek/jdk1.8.0_65
env CQ_PORT=4504

script

exec>/app/log/aem_author/start.out 2>/app/log/aem_author/start.err &

PATH=$JAVA_HOME/bin:$PATH
/bin/sh $SERVER_HOME/crx-quickstart/bin/start
end script

 

My env: AEM 6.1, JDK 1.8

Red Hat Enterprise Linux Server release 6.4 (Santiago)

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by abhishekb

yeah i ran it once. I think now i know why it's doing that. AEM start scripts forks another process. upstart script needs to handle that with "expect fork" line.

Without that expect fork line, upstart thinks that the parent process crashed so tries for another (default) 10 times due to the respawn stanza, hence the 11 processes.

However, I am running into another issue where if the AEM's forked process dies, upstart might not know and would consider the job still running. I guess this is for linux forums. thanks for your reply.

5 replies

Jitendra_S_Toma
Level 10
December 3, 2015

abhishekb wrote...

Hi,

I am trying to create an upstart script for AEM server start/stop. It spawns 11 java processes when I run it (sudo start aemservice). Any pointers to what I might be doing wrong.

Here is the script

start on runlevel[2345]
stop on runlevel[016]

respawn

env SERVER_HOME=/app/server/aem61
env JAVA_HOME=/home/abhishek/jdk1.8.0_65
env CQ_PORT=4504

script

exec>/app/log/aem_author/start.out 2>/app/log/aem_author/start.err &

PATH=$JAVA_HOME/bin:$PATH
/bin/sh $SERVER_HOME/crx-quickstart/bin/start
end script

 

My env: AEM 6.1, JDK 1.8

Red Hat Enterprise Linux Server release 6.4 (Santiago)

 

Did you run "aemservice" only once?. On a few occasions, it happens if you start/stop instance multiple times primarily on Linux system. But don't know why?. It just creates another fork process.

--

Jitendra

abhishekbAuthorAccepted solution
Level 3
December 3, 2015

yeah i ran it once. I think now i know why it's doing that. AEM start scripts forks another process. upstart script needs to handle that with "expect fork" line.

Without that expect fork line, upstart thinks that the parent process crashed so tries for another (default) 10 times due to the respawn stanza, hence the 11 processes.

However, I am running into another issue where if the AEM's forked process dies, upstart might not know and would consider the job still running. I guess this is for linux forums. thanks for your reply.

Jitendra_S_Toma
Level 10
December 3, 2015

abhishekb wrote...

yeah i ran it once. I think now i know why it's doing that. AEM start scripts forks another process. upstart script needs to handle that with "expect fork" line.

Without that expect fork line, upstart thinks that the parent process crashed so tries for another (default) 10 times due to the respawn stanza, hence the 11 processes.

However, I am running into another issue where if the AEM's forked process dies, upstart might not know and would consider the job still running. I guess this is for linux forums. thanks for your reply.

 

No problem. :)

au4liferz
Level 4
December 3, 2015

There is a "-nofork option that you may want to explore, (in the original start up scripts in the .../author/crx-quickstart/bin directory). If you use it, you'll probably need to use the -Xmx2048m option as well and be sure to give it enough memory/RAM. I believe one of the primary reasons the process forks is because it doesn't have enough memory.

abhishekbAuthor
Level 3
December 4, 2015

hmm. let me try to use that option