Expand my Community achievements bar.

SOLVED

AEM Upstart Script creates multiple java processes

Avatar

Level 3

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)

1 Accepted Solution

Avatar

Correct answer by
Level 3

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.

View solution in original post

5 Replies

Avatar

Level 9

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

Avatar

Correct answer by
Level 3

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.

Avatar

Level 9

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. :)

Avatar

Level 4

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.

Avatar

Level 3

hmm. let me try to use that option