Adobe CQ: Startup Scripts for Author and Publisher

Adobe-CQ-264x300Recently, I stood up a CQ5.6 stack on a local machine running CentOS 6 for testing some things and one of tasks I have been wanting to do is automate the startup scripts for the author and publisher instances.  In the past, we did not have much luck but never really invested the time to work it out, so I took this rare opportunity to tackle the problem.

First, as with most things, was to search Google.  As luck would have it, I found several posts on the subject but not of the scripts worked out of the gate, so I tweaked them to fit my needs and now everything is working well.  First, here is my author script… it is the same as my publisher script except for the obvious ‘author/publisher’ folder in the path:

# /etc/r.d/init.d/cqauthor
# Description: This service manages the 
# Adobe WEM Content Management java process.
# Source function library.
. /etc/rc.d/init.d/functions
case "$1" in
echo -n "Starting cq5 services: "
su - ${CQ5_USER} ${START}
touch /var/lock/subsys/cq5
echo -n "Shutting down cq5 services: "
su - ${CQ5_USER} ${STOP}
rm -f /var/lock/subsys/cq5
su - ${CQ5_USER} ${STATUS}
su - ${CQ5_USER} ${STOP}
sleep 5s # gives the system time to shutdown
su - ${CQ5_USER} ${START}
echo "Usage: cq5 {start|stop|status|restart}"
exit 1

For these scripts, I removed the ‘reload function’ and created a ‘restart’ function.  Just sounds better.  Also, I added the ‘sleep 5s’ between the stop and start in the restart function because some systems take a little bit of time to kill off the processes.  I have yet to test this on a production system with a huge JCR which may require that I add a couple more seconds.

Next I saved a version for the author and publisher in the /etc/rc.d/init.d/ folder and named them ‘cqauthor’ and ‘cqpublisher.’  I thought about having one script that accepts an argument for server type but most likely, this scripts will be on a server with only one instance of CQ running so it really wasn’t a compelling exercise other than to just do it.

Finally, I added them to the chkconfig so they would fire when the server started:

chkconfig on cqauthor

Also, The ‘start’ and ‘status’ scripts in the crx-quickstart/bin folder were not able to find java.  This is probably due to my not setting the java path globally.  To quickly fix the issue, I added the following to these two scripts:


$JAVA_HOME/java… (prefix wherever java appears).

This fixed the problem for the time being.  As I mentioned in past posts, I NEED to control which JDK is running on my machines so, java is passively available to the system via the path.  This is not an optimal production server config but it works rather well for my local workstations where I am the only user.


EDIT:  Giving credit where credit is due.  This blog is where I started my script work:

Here’s another that I used as well: (scroll to the bottom… the second script was designed for cq5.5)


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s