Chuyển đến nội dung chính

How to startup scripts for Author and Publisher

Use case : You want to start and stop CQ on system start and stop

Solution: Here is script that you can use. Put this script in /etc/init.d


1. Create a file /etc/init.d/cq5 on your server and copy the contents from below script.
2. edit the file and make the following changes
update the "pidfile:" config to match your cq instance
update the "CQ5_ROOT" and "CQ5_USER" variables to match your cq instance
3. Run this command:
chmod 755 /etc/init.d/cq5
4. Run this command to add the config to redhat startup and shutdown:
chkconfig --add cq5

Recently, 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:
#!/bin/bash
#
# /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
CQ5_ROOT=/opt/adobe_cq/author
CQ5_USER=root
########
SERVER=${CQ5_ROOT}/crx-quickstart
START=${SERVER}/bin/start
STOP=${SERVER}/bin/stop
STATUS="${SERVER}/bin/status"
case "$1" in
start)
echo -n "Starting cq5 services: "
su - ${CQ5_USER} ${START}
touch /var/lock/subsys/cq5
;;
stop)
echo -n "Shutting down cq5 services: "
su - ${CQ5_USER} ${STOP}
rm -f /var/lock/subsys/cq5
;;
status)
su - ${CQ5_USER} ${STATUS}
;;
restart)
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
;;
esac
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=/opt/java/bin
$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: http://cqdump.wordpress.com/2011/11/15/cq5-init-script/
Here’s another that I used as well: http://www.wemblog.com/2011/11/how-to-write-cq-wem-init-script-for.html (scroll to the bottom… the second script was designed for cq5.5)

Nhận xét

Bài đăng phổ biến từ blog này

How to add a new supported language in CQ / WEM (Translator in CQ)

Use case:  You want to add new language to CQ Change display language options in translator grid Change language name and default countries  Solution: You can access translator UI in CQ with following URL http://<HOST>:<PORT>/libs/cq/i18n/translator.html Create new language location for Dictionary Go to CRXDE lite (or your favorite JCR browser) and add this structure (assuming /apps/myapp/i18n as a typical location for custom apps): /apps/myapp/i18n [sling:Folder]     - de [nt:unstructured]         + jcr:mixinTypes = [mix:language]         + jcr:language = de     - fr [nt:unstructured]         + jcr:mixinTypes = [mix:language]         + jcr:language = fr Then reload the translator and the path /apps/ myapp /i18n should show up in the drop-down at the top. Note: the translator will only save translations for languages that are actually present underneath the path (e.g. /apps/myapp/i18n), others will be skipped. Then on jsp pa

Login / Logout on a Publish instance and Closed User Group (CUG)

In CQ5 there is the login logout could be configured using a Closed User Group. Closed User Groups (CUGs) are used to limit access to specific pages that reside within a published internet site. Such pages require the assigned members to login and provide security credentials. http://dev.day.com/docs/en/cq/5-4/howto/create_apply_cug.html The logout using /libs/cq/core/content/login.logout.html always gets redirected to the geometrixx site   http://localhost:4503/content/geometrixx-outdoors/en.html By configuring the Default login page  under the osgi configuration for com.day.cq.auth.impl.LoginSelectorHandler to be – /content/mysite/en/login But still after logout the page goes to the geometrixx site. IIRC, the redirect first goes to to / which then goes through the standard, somewhat complex handling of the root with multiple redirects: 1) / has a resource type of sling:redirect and redirects to /index.html 2) /index.html is handled by the RootMappingServlet [0] which h

[PERFORMANCE] Adobe WEM/CQ performance tuning

Adobe WEM/CQ performance tuning Contents Caching-related configurations CRX Bundle cache CRX Search index handler (Lucene) cache Tar PM index cache Scalability Maintenance Optimizing Tar Files (for Tar Persistence Manager) Data Store Garbage Collection Main documentation you should consult first: http://dev.day.com/docs/en/cq/current/deploying/performance.html http://dev.day.com/content/kb/home/cq5/CQ5Troubleshooting/performancetuningtips.html Caching-related configurations CRX Bundle cache CRX caches bundles, consisting of a node with all its properties. This is used by all bundle-based Persistence Managers. The default size of BundleCache is 8 MB. If this is too small it can cause an excessive number of read-accesses to the underlying persistence layer. Set the bundleCacheSize to something larger than the default. See more here: http://dev.day.com/docs/en/cq/current/deploying/performance.html#CRX%20Bundle%20Cache CRX Search index handler (Lucene