Skip to content

Instantly share code, notes, and snippets.

View jayankandathil's full-sized avatar

Jayan Kandathil jayankandathil

View GitHub Profile
@jayankandathil
jayankandathil / perf_measurement_servlet.java
Last active December 18, 2015 12:19
Sample code snippet showing measurement of actions within a Java servlet and returning the information back to the browser
import java.io.PrintWriter;
import java.text.DecimalFormat;
import javax.servlet.http.HttpServletResponse;
final long lngStart;
final long lngEnd;
final double dblElapsedTime;
// Get timestamp
lngStart = System.currentTimeMillis();
@jayankandathil
jayankandathil / cq_maintenance.sh
Last active September 27, 2016 14:31
Bash shell script to run Adobe CQ (Experience Manager) maintenance operations on Red Hat Enterprise Linux. Tested on RHEL 6.3 and 6.4
#!/bin/bash
# Bash script to run CQ daily maintenance operations, excluding TarPM Optimization and Tar Index Merge
# Author : Jayan Kandathil
# Version : 0.4
# Last updated : May 24, 2013
# Instructions : Copy to CQ's /bin folder, make necessary changes, enable the execute bit and run
@jayankandathil
jayankandathil / get_cq_page.java
Last active December 18, 2015 17:19
Sample Java servlet code snippet showing how to use Apache HTTPComponents (tested with httpclient-4.2.3.jar and httpcore-4.2.2.jar) to connect to a remote Adobe Experience Manager (CQ) instance and GET a web page for server health check (heartbeat) purposes.
import java.io.IOException;
import java.io.PrintWriter;
import java.net.URI;
import java.net.URISyntaxException;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.ResponseHandler;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.utils.URIBuilder;
#!/bin/bash
# Bash script to invoke CQ Backup using CURL
# Author : Jayan Kandathil
# Version : 0.4
# Last updated : May 24, 2013
# Instructions : Copy to CQ's /bin folder, make necessary changes, enable the execute bit and test
@jayankandathil
jayankandathil / start.sh
Last active February 9, 2017 02:06
Production-quality start script for CQ 5.6.1 (Adobe Experience Manager) with JVM heap and garbage collection tuning - assumes the use of a 1.7 Oracle "HotSpot" JDK
#!/bin/bash
#
# This script configures the start information for this server.
#
# The following variables may be used to override the defaults.
# For one-time overrides the variable can be set as part of the command-line; e.g.,
#
# % CQ_PORT=1234 ./start
#
@jayankandathil
jayankandathil / start.bat
Last active January 12, 2017 08:55
Production-quality Windows start.bat for CQ 5.6.1 (Adobe Experience Manager) with JVM heap and garbage collection tuning - assumes the use of a 1.7 Oracle "HotSpot" JDK
@echo off
:: This script configures the start information for this server.
::
:: The following variables may be used to override the defaults.
:: For one-time overrides the variable can be set as part of the command-line; e.g.,
::
:: SET CQ_PORT=1234 & ./start.bat
::
setlocal
# ------------------------------------------------
# AWK script to print unique user IDs in a folder
# containing a collection of CQ's access.logs
# ------------------------------------------------
# Usage : gawk -f /opt/scripts/parse-cq-access-logs.awk /opt/aem/crx-quickstart/logs/access.log.*
# Author : Jayan Kandathil
# Last updated : April 16, 2014
# Version : 0.1
@jayankandathil
jayankandathil / start.bat
Last active June 16, 2017 15:31
Adobe AEM 6.0 Windows start.bat for MongoDB (DEV environment)
@echo off
:: This script configures the start information for this server.
::
:: The following variables may be used to override the defaults.
:: For one-time overrides the variable can be set as part of the command-line; e.g.,
::
:: SET CQ_PORT=1234 & ./start.bat
::
setlocal
@jayankandathil
jayankandathil / Sling-AverageRequestDurationMilliseconds.groovy
Last active August 29, 2015 14:06
Groovy script that reports Apache Sling average request duration
// Author : Jayan Kandathil
// Last Updated : June 18, 2014
// Version : 0.1
// Need following JVM init arguments for JMX access (Windows .bat example)
// set CQ_JVM_OPTS=%CQ_JVM_OPTS% -Dcom.sun.management.jmxremote
// set CQ_JVM_OPTS=%CQ_JVM_OPTS% -Dcom.sun.management.jmxremote.port=10000
// set CQ_JVM_OPTS=%CQ_JVM_OPTS% -Dcom.sun.management.jmxremote.authenticate=false
// set CQ_JVM_OPTS=%CQ_JVM_OPTS% -Dcom.sun.management.jmxremote.ssl=false
@jayankandathil
jayankandathil / Workflow-AverageProcessingTimeMilliseconds.groovy
Last active August 29, 2015 14:06
Groovy script that reports average CQ and AEM workflow processing time
// Author : Jayan Kandathil
// Last Updated : June 18, 2014
// Version : 0.1
// Need following JVM init arguments for JMX access (Windows .bat example)
// set CQ_JVM_OPTS=%CQ_JVM_OPTS% -Dcom.sun.management.jmxremote
// set CQ_JVM_OPTS=%CQ_JVM_OPTS% -Dcom.sun.management.jmxremote.port=10000
// set CQ_JVM_OPTS=%CQ_JVM_OPTS% -Dcom.sun.management.jmxremote.authenticate=false
// set CQ_JVM_OPTS=%CQ_JVM_OPTS% -Dcom.sun.management.jmxremote.ssl=false