Wednesday, June 12, 2013

How to Disable Replication Agent using CURL in Adobe CQ / AEM

Use Case:

  • You want to disable replication agent without going to console.
  • You are doing a production deployment and want to disable replication agent
  • You want author not to replicate 
  • You want dispatcher not to get flush
Solution:

# !/bin/bash
# Author: upadhyay.yogesh@gmail.com
# The host and port of the source server
SOURCE="localhost:4502"
# The user credentials on the source server (username:password)
SOURCE_CRED="admin:admin"

#Root path, You can change this path to target only author or publish agent
ROOT_PATH="/etc/replication"

ALL_PATHS=`curl -s -u $SOURCE_CRED "$SOURCE/bin/querybuilder.json?path=$ROOT_PATH&type=nt:unstructured&1_property=cq:template&1_property.value=/libs/cq/replication/templates/%&1_property.operation=like&2_property=enabled&2_property.value=true&p.limit=-1" | tr ",[" "\n" | sed 's/ /%20/g' | grep path | awk -F \" '{print $4 "\n"}'`
echo "$ALL_PATHS"
for SINGLE_PATH in $ALL_PATHS
do
curl -s -u $SOURCE_CRED -F"enabled=false" $SOURCE$SINGLE_PATH
done

If you already know replication agent name you can also do following,

for agent in flush flush1 {Other agent name}
do echo Disabling /etc/replication/agents.author/${agent} 
curl -D- -o /dev/null -XPOST -F./enabled=false http://admin:admin@HOST:PORT/etc/replication/agents.author/${agent}/jcr:content 2>/dev/null done

Please test it before use.

1 comment:

  1. I am a professional writer with experience in travel, career development, and personal empowerment. I studied creative writing and history at a sunny little liberal arts college in
    For more info visit: concierge service

    ReplyDelete